Score:0

apache reverse proxy not working

in flag

I am using my apache container as a reverse-proxy and trying to access one of my VM services. It is working when I configure like,

ProxyPassMatch "^/(.*)$" "https://host1:443/$1"
ProxyPassReverse "^/(.*)$" "https://host1:443/$1"

With the above config I am able to access all the urls of https://host1:443/*. But When I want to access via an explicit worker like,

ProxyPassMatch "^/sample/(.*)$" "https://host1:443/$1"
ProxyPassReverse "^/sample/(.*)$" "https://host1:443/$1

It says "The requested URL /p/login/ was not found on this server." I tried many solutions and couldn't get to work.

Score:0
la flag
ProxyPassMatch "^/sample/(.*)$" "https://host1:443/$1"

When you only reverse proxy to host1 the URI paths starting with /sample/ requests for /p/login/ shouldn't get forwarded. The requests for /p/login/ will be handled locally by your apache and won't reach host1.

When that path/URI is not present on your apache container that triggers the 404 - file not found error ""The requested URL /p/login/ was not found on this server."

You usually get such an error because the HTML code on host1 links to the absolute path /p/login/ and a common misconception is the reverse proxy would change such a reference to /sample/p/login/ by using the ProxyPassReverse directive. ProxyPassReverse doesn't do that. It only adjusts the URL in the Location, Content-Location and URI headers ; and not in the body/HTML code.

There are several things you can do to resolve that ; as detailed in this answer (Note both your question and that answer are tagged with apache version 2.2 ; the other two answers in that question provide a solution for current version 2.4)

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.