You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I used this to build a dockerized API with Django Rest Framework. Since I develop several projects at once, I use a different port for local development. Turns out that Django or at least Django Rest Framework was not able to produce the right absolute URLs in the browsable API. Instead of localhost:12345/api, I only got localhost/api.
So I used this to build a dockerized API with Django Rest Framework. Since I develop several projects at once, I use a different port for local development. Turns out that Django or at least Django Rest Framework was not able to produce the right absolute URLs in the browsable API. Instead of
localhost:12345/api
, I only gotlocalhost/api
.What I tried:
USE_X_FORWARDED_FOR_HOST
andUSE_X_FORWARDED_FOR_PORT
to True, see https://docs.djangoproject.com/en/3.0/ref/settings/#use-x-forwarded-hostAnyway, what fixed it for me was using
$http_host
instead of$host
in the nginx config.My issue: lorey/socials-api#4
My configuration: https://github.com/lorey/socials-api/tree/d7f0bca4df5be9c662ede96aac6ae89d17890404
Hope this helps anyone. Let me know if someone finds a better solution or can explain this.
The text was updated successfully, but these errors were encountered: