I am trying to create a proxy at a URL on my "master" site to a remote site, "east", but I get stuck in a redirection loop. This isn't the behaviour I was expecting - I understood ProxyPass would rewrite the content to the URL, but I think it's acting as if it's redirecting to the "master" host.
The configuration file applied is pretty straightforward:
user@master:/etc/apache2/conf-enabled# cat multisite_proxy.conf
<Location /prod_east>
ProxyPass http://east.domain.com/prod_east
ProxyPassReverse http://east.domain.com/prod_east
</Location>
using cURL, my output is as:
user@master:~# curl -IL https://master.domain.com/prod_east/
HTTP/1.1 302 Found
Date: Thu, 17 Dec 2020 22:58:41 GMT
Server: Apache/2.4.38 (Debian)
Location: https://master.domain.com//prod_east/
Content-Type: text/html; charset=iso-8859-1
...
curl: (47) Maximum (50) redirects followed
The Apache logs on east are showing cURL's requests.
If I browse http://east.domain.com/prod_east
I get redirected to an application's login page (which I expect). Examining that with cURL, I see:
user@master:~# curl -IL http://east.domain.com/prod_east
HTTP/1.1 302 Found
Date: Thu, 17 Dec 2020 23:17:38 GMT
Server: Apache/2.4.38 (Debian)
Location: https://east.domain.com//prod_east
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 302 Found
Date: Thu, 17 Dec 2020 23:17:38 GMT
Server: Apache
Location: https://east.domain.com/prod_east/subpath/
Content-Type: text/html; charset=iso-8859-1
HTTP/1.1 302 FOUND
Date: Thu, 17 Dec 2020 23:17:38 GMT
Server: Apache
Vary: Cookie
Cache-Control: no-cache
**Location: /prod_east/subpath/login.py?_origtarget=index.py**
Content-Type: text/html; charset=UTF-8
The last Location: entry has me wondering: It's telling the client to redirect to /prod_east/
, but I expect that to be requested from east.domain.com
because of the ProxyPass rules.
The Proxy module is enabled, as is the rewrite module.
Any help? I'm clearly not understanding something here...
Thanks in advance.
The issue here was that the "east" site was forcing a redirection to HTTPS, and Apache wasn't configured to proxy TLS content. After enabling SSLProxy on "master", and updating
multisite_proxy.conf
to refer to https (thus skipping the HTTP->HTTPS redirection), this is now working.