Flask-OpenID issues with proxy server Flask-OpenID issues with proxy server flask flask

Flask-OpenID issues with proxy server


It sounds like your proxy server isnt passing on the HOST header, using nginx you can use proxy_set_header Host $host; in your location directive.

You may also want to look at setting the X-Forwarded-For and X-Forwarded-Proto headers so you can read the actual client IP and protocol correctly. Werkzeug provides a fixer to help with this, and there's an example detailed in the Flask docs, request.remote_addr should then be what you expect.

Here's a more complete nginx location directive:

location / {    proxy_pass  http://localhost:8000/;    proxy_set_header Host $host;    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;    proxy_set_header X-Forwarded-Proto $scheme;}