use django facilities to get hostname from request (#16525)
This is required as SERVER_NAME may not be used in some uwsgi configuration, and HTTP_HOST should be used instead. | Nginx maps the $server_name variable to the first server_name you define. | In your case you have two solutions: read HTTP_HOST instead of SERVER_NAME | in your app or set SERVER_NAME to $http_host in uwsgi_params -- http://lists.unbit.it/pipermail/uwsgi/2010-August/000571.html The HttpRequest.get_host method handles those cases and more.
This commit is contained in:
parent
4201b41cdb
commit
7767bc6740
|
@ -35,7 +35,7 @@ class PassiveAuthenticationMiddleware(object):
|
|||
# get the common domain or guess
|
||||
common_domain = app_settings.OPENED_SESSION_COOKIE_DOMAIN
|
||||
if not common_domain:
|
||||
common_domain = request.META['SERVER_NAME'].split('.', 1)[1]
|
||||
common_domain = request.get_host().split('.', 1)[1]
|
||||
assert '.' in common_domain # if domain is xxx.com explode !
|
||||
params = {
|
||||
'next': request.build_absolute_uri(),
|
||||
|
|
Loading…
Reference in New Issue