Skip to content
Snippets Groups Projects
Commit 2f7308ed authored by Jamie Forth's avatar Jamie Forth
Browse files

Proxy debugging.

parent 87bf74f4
No related merge requests found
......@@ -6,6 +6,7 @@ app_name = 'chords'
urlpatterns = [
# Study paths.
path('echo-headers', views.echo_headers, name='echo-headers'),
path('', views.index, name='index'),
path('profile', views.edit_profile, name='profile'),
path('guitar', views.next_trial, {'instrument': 'guitar'},
......
import json
from django.contrib.auth.decorators import login_required, user_passes_test
from django.http import HttpResponseBadRequest, JsonResponse
from django.http import HttpResponse, HttpResponseBadRequest, JsonResponse
from django.shortcuts import redirect, render
from django.views.decorators.cache import never_cache
from django.views.decorators.http import (require_http_methods, require_POST,
......@@ -17,6 +17,13 @@ def name_is_provided(user):
)
def echo_headers(request):
headers = ''
for key, value in request.META.items():
headers = headers + '{}: {}\n'.format(key, value)
print(headers)
return HttpResponse(headers)
@login_required(redirect_field_name=None)
@require_safe
def index(request):
......
......@@ -174,7 +174,7 @@ class Prod(Base):
STATIC_ROOT = "/var/www/l2p-play-web/static/"
# Must be false in production!
DEBUG = False
DEBUG = True
# Use forwarded host (for generating email links)
USE_X_FORWARDED_HOST = True
......
......@@ -14,3 +14,23 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "playability.settings")
from configurations.wsgi import get_wsgi_application
application = get_wsgi_application()
#_application = get_wsgi_application()
#def application(environ, start_response):
# script_name = environ.get('HTTP_X_SCRIPT_NAME', '')
# print(script_name)
# print(environ.get('SCRIPT_NAME'))
# print(environ.get('SCRIPT-NAME'))
# #return None
# if script_name:
# environ['SCRIPT_NAME'] = script_name
# path_info = environ['PATH_INFO']
# if path_info.startswith(script_name):
# environ['PATH_INFO'] = path_info[len(script_name):]
#
# scheme = environ.get('HTTP_X_SCHEME', '')
# if scheme:
# environ['wsgi.url_scheme'] = scheme
#
# return _application(environ, start_response)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment