Bug #16525
utiliser request.META['HTTP_HOST'] plutôt que 'SERVER_NAME'
Statut:
Fermé
Priorité:
Normal
Assigné à:
-
Version cible:
-
Début:
27 mai 2017
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Description
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
Proposition d'utiliser HTTP_HOST.
Fichiers
Demandes liées
Révisions associées
Historique
Mis à jour par Frédéric Péters il y a presque 7 ans
- Fichier 0001-get-hostname-with-HTTP_HOST-instead-of-SERVER_NAME-1.patch 0001-get-hostname-with-HTTP_HOST-instead-of-SERVER_NAME-1.patch ajouté
- Statut changé de Nouveau à En cours
- Patch proposed changé de Non à Oui
Mis à jour par Frédéric Péters il y a presque 7 ans
- Bloque Development #16527: Passer à uwsgi ajouté
Mis à jour par Thomas Noël il y a presque 7 ans
En Django la bonne méthode semble être request.get_host() (https://docs.djangoproject.com/en/1.11/ref/request-response/#django.http.HttpRequest.get_host) (que je vois utilisée dans tenant-schema)
Mis à jour par Frédéric Péters il y a plus de 6 ans
- Fichier 0001-use-django-facilities-to-get-hostname-from-request-1.patch 0001-use-django-facilities-to-get-hostname-from-request-1.patch ajouté
Je redécouvre ceci, nouveau patch attaché.
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.