I want that when i hit URL A, it should serve content from URL B but the URL on the address bar should keep pointing to URL A only.
URL A: http://apps.company.com/lab
URL B: http://svrdev-73:6020
To try this out, in hosts
file, i have configured the following:
172.16.0.73 apps.company.com
I am using Windows server 2016. Application B and Apache (ver. 2.4
), both are running on same Windows server. I found that ProxyPass
and ProxyPassReverse
might help.
Added the following lines at the end of httpd.conf
file:
ProxyRequests Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode
<Proxy http://svrdev-73:6020/*>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /lab http://svrdev-73:6020 nocanon
ProxyPassReverse /lab http://svrdev-73:6020
After (mis)configuring, when i try hitting URL A, though it takes me to the login page that comes up when i directly access URL B, but when i login, it doesn't display anything. In console section of my browser, i see the following:
Failed to load resource: the server responded with a status of 404 (Not Found) main.00e8fde0.css:1
Failed to load resource: the server responded with a status of 404 (Not Found) main.aa149470.js:1
When i check the Apache log, i see this:
[Sun Sep 23 12:35:54.949711 2018] [core:info] [pid 20708:tid 1072] [client 172.16.0.73:60914] AH00128: File does not exist: C:/apache24/htdocs/static/css/main.00e8fde0.css, referer: http://apps.company.com/lab
[Sun Sep 23 12:35:54.949711 2018] [authz_core:debug] [pid 20708:tid 1076] mod_authz_core.c(817): [client 172.16.0.73:60913] AH01626: authorization result of <RequireAny>: granted, referer: http://apps.company.com/lab
From the above i see that it is looking for file in the default DocumentRoot
directory (i.e., "${SRVROOT}/htdocs"
) however, my application code (URL B) is in Tomcat at c:\app-tomcat\webapps\ROOT\
directory. I also tried changing the DocumentRoot dir path to c:/app-tomcat/webapps/ROOT
where index.html resides along with static dir and other files but i am still getting the same error. I also changed this property <Directory "${SRVROOT}/htdocs">
to <Directory "c:/app-tomcat/webapps/ROOT">
but the error persists. No other modifications were done to the httpd.conf
or any other file in Apache except for changing the log level and enabling mod_proxy
and mod_proxy_http
module.
Any idea how i can resolve this?