Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django REST framework absolute urls with nginx always return 127.0.0.1

I've an app running on gunicorn / django (with django-rest-framework) behind nginx and I've a little problem with the url return by the rest framework when using the hyperlinkedmodelserializer. They always return something like http://127.0.0.1/ instead of my host name.

Could you help please ?

like image 801
Pawel Kozela Avatar asked Oct 29 '13 21:10

Pawel Kozela


1 Answers

Never mind, I've found I've forgot to put

proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 

in my nginx config. Works fine now.

like image 55
Pawel Kozela Avatar answered Sep 29 '22 16:09

Pawel Kozela