[Solved]-Django-allauth signin with google redirects to development url even in production



I found that the issue occurs because the nginx proxy, which sits in front of the python app server, sets the HTTP Host header to localhost.

So when allauth tries to do request.build_absolute_uri, HTTP_HOST is localhost.

So I set the Setting proxy_set_header in the nginx configuration file which fixed the issue.

proxy_set_header Host $http_host;

Also see Facebook oauth authentication is redirecting to localhost instead of to my domain for the same issue in a different avatar.


Leave a comment