After a successful authentication using google-oauth2 with the python-social-auth tool, the client gets redirected to a ../complete/ page. However, after forwarding all non-static traffic from the apache to a local gunicorn server, the redirection url points to http://localhost:8000/complete rather than to the real website. This can be easily fixed by enabling the ProxyPreserveHost setting in the apache config:
<VirtualHost *:80>
ServerAdmin ...
ServerName ...
Alias /static /.../static
DocumentRoot ...
<Directory ...>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ProxyPreserveHost on
RewriteEngine on
RewriteRule ^/static/.* - [L]
# Django is run via gunicorn. So proxy the rest.
RewriteRule ^(.*) http://localhost:8000$1 [P]
</VirtualHost>
0 Comments.