Closed achimgaedke closed 8 years ago
This issue should be at low priority:
Using uwsgi_pass_request_headers off
fixes the issue, but probably does some other harm...
location / {
auth_basic 'merlin';
auth_basic_user_file /etc/nginx/access_pwd;
include uwsgi_params;
uwsgi_pass_request_headers off;
uwsgi_pass merlin-api.:8081;
}
More elegant quick-fix/dirty hack: modify django-merlin/merlin/wsgi.py
to get rid of the 'Authorization' header, which seems to confuse django and the undead Authentication/Authorization system.
application1 = get_wsgi_application()
def application(environ, start_response):
try:
del environ['HTTP_AUTHORIZATION']
except KeyError:
pass
return application1(environ, start_response)
(that allows the django middleware to choose encoding and so on...)
When using the django application with uwsgi and an nginx 'frontend' web server configured to use http authentication, the '/api' calls are no longer working.
Setup in detail:
Using this deployment (as it would be used to make a development version available worldwide) e.g. on merlin-3l.cloudapp.net or later using cardhu:
It has the following flaw:
Calling https://merlin-3l.cloudapp.net/api/simulations/1/ results in an HTTP 403 error with:
So, the login mechanism of nginx seems to have repercussions in the django user management, which is not (fully) configured or filled with user data sets. In contrast to that the static files seem to be served fine.
A first try to get things right, I've (configured and) used the admin site to add users. Logging in such a (super)user helps to read (GET) data, but not modify (e.g. set coordinates).