DEV Community

Discussion on: How to Host a Flask Server With Gunicorn and HTTPS

Collapse
 
biofool profile image
Kenneth Kron

This get's the app up and running but I'm having issues with app routing.
The app runs fine if I'm connected to port 5000 but when I put it behind nginx as a reverse proxy the logout link which is defined in flask as

With the following location:

        location @proxy_to_app {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header HOST $http_host;
                proxy_pass http://127.0.0.1:8080/$request_uri;
                include proxy_params;
                proxy_redirect off;
}
Enter fullscreen mode Exit fullscreen mode

This function:

@bp.route("/logout")
def logout():
    """Clear the current session, including the stored user id."""
    session.clear()
    return render_template("index.html")
Enter fullscreen mode Exit fullscreen mode

Sends the user to a 500 error code.