Apache forwarding without redirecting (application won't follow redirects)

Posted by DrewVS on Server Fault See other posts from Server Fault or by DrewVS
Published on 2012-11-02T14:57:55Z Indexed on 2012/11/02 17:07 UTC
Read the original article Hit count: 169

Filed under:
|
|

Recently we had to move /task to /public/task, and I'd like to configure Apache to redirect accordingly.

However, using mod_rewrite, though it works in the browser, seems to break applications making api calls to the above location. What happens is the application returns a page with the message saying the page was moved, but the app doesn't follow the redirect.

So, is there a way to simply forward any traffic to /task to /public/task without 'redirecting', i.e, returning a redirect status code?

EDIT: Here's a little more information. I've found a simple test to clarify what I'm trying to fix. Here is the URL path that needs forwarding:

https://mydomain.com/task

Needs to go to:

https://mydomain.com/public/task

If I use curl against the original domain, it just returns a redirect page notice. If I add the -L flag, which tells curl to follow redirects, it then follows the redirect successfully.

I assume something very similar is happening in the application (which I don't have access to) that makes calls to the /task URL path. Since I cannot modify the application to make it follow redirects properly, I'm looking for a solution I can implement in Apache.

© Server Fault or respective owner

Related posts about apache2

Related posts about mod-rewrite