Just to make life difficult - I'm trying to setup a double reverse proxy:
WWW > Router > Apache Reverse Proxy #1 (443) > Apache Reverse Proxy (443) #2 > Docker Container (Which runs on same machine as #2)
Both reverse proxies have FQDNs. I'm trying to use Virtual Hosts but clearly don't understand how to set up the proxy.
The main domain is
example.com (hosted on Apache #1), and subdomain
office.example.com (hosted on Apache #2).
On Apache #1 I have to Virtual Hosts setup (
office.example.com). The virtual host file for
office.example.com appears like this:
<VirtualHost *:443> ServerName office.example.com UseCanonicalName off DirectoryIndex index.html index.htm /index.php index.php DocumentRoot /usr/local/www/office .... .... # keep the host ProxyPreserveHost On ProxyPass / https://office.example.com ProxyPassReverse / https://office.example.com .... .... </VirtualHost>
My DNS records are at Cloudflare and both
example.com resolve to the same external IP address. The pfSense router however has a DNS Override that reassigns office.example.com to an internal LAN address
On Apache #2 my virtual host file appears as the following:
<VirtualHost *:443> ServerName office.example.com DocumentRoot "/var/www/office.example.com/html" DirectoryIndex index.html index.htm /index.php index.php ... ... ProxyPreserveHost On # static html, js, images, etc. served from loolwsd # loleaflet is the client part of LibreOffice Online ProxyPass /loleaflet http://127.0.0.1:9980/loleaflet retry=0 ProxyPassReverse /loleaflet http://127.0.0.1:9980/loleaflet ... ... </VirtualHost>
I left out the SSL encryption items as SSL transport is involved from Web to Apache #1 and SSL encryption from Apache #1 to Apache #2. SSL terminates at the 2nd proxy.
From the outside I can reach
https://office.example.com which correctly displays the
index.html file located at Document Root on Apache #2.
However any other link I can't resolve. I get a 500 error if I try:
I think I'm missing something with the reverse proxy requests.