Wieder was gelernt

Apache2 Proxying

Tags: web apache reverse proxy gunicorn
2024-02-28
<Location /demo>
    RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
    RequestHeader set X-Forwarded-SSL expr=%{HTTPS}

    ProxyPass        unix:/usr/local/www/example/data/demo.socket|http://example.com/demo
    ProxyPassReverse unix:/usr/local/www/example/data/demo.socket|http://example.com/demo
</Location>

The combination of the RequestHeader settings and the http://example.com/demo pseudo url passes all the necessary information to the backend so that request.url in a flask application shows up correctly as https://example.com/demo…