Score:0

ProxyPass not working alongside ProxyPassMatch

lc flag

So at the moment I have a virtual host configured on my Oracle HTTP Server instance with a ProxyPass as such:

ProxyPass ^/test/home/ https://example.com/
ProxyPassMatch ^/test/home/(.*)$ https://example.com/$1
ProxyPassReverse ^/test/home/(.*)$ https://example.com/$1

When I attempt to access https://mywebsite.com/test/home/<url_from_other_server> the request seems to be working as expected. However, when I attempt to access https://mywebsite.com/test/home/ it is not proxying me to https://example.com/ but rather returning a 404.

The ProxyPassMatch wildcard seems to be working for all suburls I attempt to access, but the regular ProxyPass keyword is not.

I have also attempted removing the ProxyPass entirely and I get the same 404 error when attempting to access /test/home/

Does anyone have any idea what could be causing this strange behaviour?

Thank you.

Bil avatar
td flag
Bil
Can you edit post with your full vhost ?
Ress avatar
lc flag
Hi @Bill. I've updated with the solution. Thanks.
Score:0
lc flag

The issue has been addressed. The correct configuration for this particular problem is the following:

ProxyPass /test/home(.*)$ https://example.com/$1
ProxyPassReverse /test/home(.*)$ https://example.com/$1

Removing the slash and adding the wildcard has enabled us to proxy anything following /test/home.

Thank you all for your input.

Score:0
in flag

Your regex is not quite correct. * means "zero or more occurrences", so https://mywebsite.com/test/home/ is matched by it. Change (.*) to (.+), which means "one or more occurrences". Then your ProxyPassMatch should not match that URL anymore.

Or just remove the ProxyPassMatch line completely, it is pretty useless, the urls are handled like it by the ProxyPass line automatically.

ProxyPass /test/home/ https://example.com/
ProxyPassReverse /test/home/ https://example.com/
Ress avatar
lc flag
Hi Gerald. I've attempted that solution but it's simply going straight to a 404 now whenever accessing /test/home or any other sub-url instead of only the /test/home not working. Do you have any idea why this may be?
in flag
Check the server logs, it should show where the request ends up
Ress avatar
lc flag
Thanks for the quick answer Gerald. On the access_log logfile I can see the request going through and returning a 404 for the /test/home and a 403 (which is expected, the server-to-proxy is not yet accepting our requests) for /test/home/page1.
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.