Setup: 1. Apache ([public_ip]:443 --> 2. Varnish [::1]:6081 --> 3. Apache ([::1]:80)
- I am running Apache2.4 as HTTPS terminator.
- Apache connects to a local varnish cache via mod_proxy.
- The varnish cache queries the local backend if needed.
I have to enable "ProxyPreserveHost On" on the HTTPS terminator as many backend services need to inspect the original hostname.
RequestHeader set X-Forwarded-Proto expr=%{REQUEST_SCHEME}
ProxyPreserveHost On
ProxyPass / http://[::1]:6081/ upgrade=websocket
ProxyPassReverse / http://[::1]:6081/
When enabling mod_crowdsec, the apache error_log gets filled with the following warning for any request. Although setting Crowdsec off on the HTTPS terminator removes the warnings, but also disabling the filtering option on the terminator at all, which is no adequate option.
[Thu Feb 27 12:19:12.030270 2025] [proxy:warn] [pid 1306891:tid 1307043] [client <REDACTED>:62510] AH01092: no HTTP 0.9 request (with no host line) on incoming request and preserve host set forcing hostname to be <HOSTNAME> for <URI>
Appears that the received HTTP Host header is properly forwarded to the backend.
Many thanks for your support!