I have a setup with a HAProxy in front of a Varnish cache who requests an Apache2 server.
The Apache is listening on an internal IP on Port 12345 and is configured with
UseCanonicalPhysicalPort Off to prevent the spilling of that internal-use-only Port. I have also tested different combinations of
Off. However, despite those canonical directives, Apache2 seems to have problems when receiving a request for a directory without a trailing slash:
UCPP: On, UCN: Not set: Request: https://www.example.org/test-page Response: Redirect(301) to http://www.example.org:12345/test-page/ UCPP: On, UCN: On Request: https://www.example.org/test-page Response: Redirect(301) to https://www.example.org:12345/test-page/ UCPP: Off, UCN: Off Request: https://www.example.org/test-page Response: Redirect(301) without Location header
This of course won't work, as this port is only internal. The site is running a Joomla, which works fine with this setup, just those folders which would get a redirect from mod_dir don't seem to work. My Apache configuration looks like this:
<VirtualHost 192.168.150.100:12345> ServerName www.example.org UseCanonicalPhysicalPort Off UseCanonicalName On <Directory "/var/www/www.example.org"> [...] </VirtualHost>
Is there a way to prevent those redirects? Best would be to prevent those wrong redirects inside Apache, but I'd be open to configuration changes to Varnish or HAProxy.
Note: Please don't suggest to use port 80, as I have more than one port on Apache used by varnish(a workaround to get VHosts working better) and thus this is no option.