BACKEND: I have Tomcat connected to Apache and JKMount'ed to webapps.demo.example.com
.
FRONTEND: The primary VirtualHost is setup for demo.example.com
. I have one application Proxy'd to BACKEND. This works great except the ServerName and ContextPath need to pull from the FRONTEND.
Tried below, following these instructions: https://www.xinotes.net/notes/note/1954/
<VirtualHost *:80>
DocumentRoot "/home/example.com"
ServerName demo.example.com
ProxyPassInterpolateEnv On
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteRule ^ - [E=SERVER_NAME:${lowercase:%{SERVER_NAME}}]
ProxyPreserveHost On
ProxyPass "/Project1/Test" "http://webapps.demo.example.com/Test1"
ProxyPassReverse /Project1/Test http://%{SERVER_NAME} interpolate
ErrorLog "/home/logs/httpd/example-error_log"
CustomLog "/home/logs/httpd/example-access_log" common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/home/webapps"
ServerName webapps.demo.example.com
JkMount /Test1 worker1
JkMount /Test1/* worker1
ErrorLog "/home/logs/httpd/webapps-error_log"
CustomLog "/home/logs/httpd/webapps-access_log" common
</VirtualHost>
When ProxyPreserveHost On
is added my Proxy'd links return 404 instead of the Test1 Application.
What is the proper way to Proxy, while passing certain environment variables from the FRONTEND server? I am able to change the Test1 Application if absolutely nessesary. But I do need a variable to work with. Project1
cannot be a hard coded value.
Can mod_proxy_html or mod_headers help here?