Bas Bas - 1 year ago 59
Apache Configuration Question

Reverse proxy not rewriting location after redirect

I have an apache reverse proxy set up like this:

<Location /test>
ProxyPass retry=0 ttl=50

I'm sending a token to login with my request to https://localUrl/test/login.php?token=

I get redirected by the remote server and the reverse proxy rewrites the location properly to: /test/sso.php?id=61127

my request to /test/sso.php?id=61127 gets redirected again but this time the location is not rewritten properly: /status/sso.php

So it tries to find the resource on my own server while it should point to the proxy: /test/status/sso.php

What am I doing wrong, why is the second redirect location not rewritten?

Answer Source

First, you should need to match slashes in the ProxyPass directive, always, that is, in this case:https://exampleUrl should be https://exampleUrl/ because that's what it is, and you should do the same in the ProxyPassReverse directive.

In any case, better examine the replies from the backend adding the following to the LogFormat you are using:


It will print whatever location is the backend sending and help you understand what is going wrong, if matching slashes doesn't solve your issue in case it is your backend sending a /status/ for which you are not proxying.