Apache behind OpenLiteSpeed behind nginx, X-Forwarded-For is modified

#1
Good morning,

I have an issue with OpenLiteSpeed. My front proxy is nginx and it passes the trafic to OpenLiteSpeed, then OpenLiteSpeed pass it to Apache. At the nginx level, I'm crafting the correct X-Forwarded-For / X-Forwarded-Host / X-Forwarded-Proto for the request.

However, after passing to OpenLiteSpeed, OLS is alterating my X-Forwarded-For / X-Forwarded-Host / X-Forwarded-Proto headers, leading me to have multiple IP / Host in these headers at Apache level.

Instead of having X-Forwarded-For = 1.2.3.4, I have X-Forwarded-For = 192.162.68.203,127.0.0.1 ; and I have same behavior in X-Forwarded-Host.

After investigating, these headers are modified by OpenLiteSpeed. How can I disable entirely the modification of X-Forwarded-For / X-Forwarded-Host / X-Forwarded-Proto in OpenLiteSpeed configuration file?
 

Cold-Egg

Administrator
#2
Try to set the Use Client IP in the header to Trusted IP only and add Nginx IP to the Access Control > Allowed list and see if it helps.
 
#3
Hello,

I tried but seems not working:
Capture d'écran 2024-09-19 093523.png
Capture d'écran 2024-09-19 093542.png

and still having multiple hostname and multiple IP address in the headers when I check the on PHP side:
Capture d'écran 2024-09-19 094011.png

(OLS is listening on 127.0.0.1:6081 that's why I added 127.0.0.1 in trusted proxy).
 
Top