Apache web server proxy pass and get original request server name in destination
Good day,
I have the flow as follow:
(public ip) 192.168.0.142 --> (192.168.111.66) web server --> (192.168.1.199) java web app server
In my 192.168.111.66 Apache web server, I have configure the following in my httpd.conf:
ProxyPass "/image.web" "https://192.168.1.199/image.web"
ProxyPassReverse "/image.web" "https://192.168.1.199/image.web"
The network successfully reach to my web app server (192.168.1.199), however, in my java web application, I saw the request is servername is 192.168.1.199, I believe this is because of my configuration in Apache Web Server, May I know how can I configure, so that in my java web application, I can detect the request servername is 192.168.0.142, which is the public ip.
Just found the answer:
ProxyPreserveHost On
https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypreservehost