0

I am successfully using Apache mod_proxy to reverse proxy a request to testing.com/foo/bar to mybackendservice.com/foo. However, instead of the current url which is shown in the browser : testing.com/foo/bar, I would like to have the url reflect testing.com/foo. How can I achieve this? My mod proxy setup looks something like:

ProxyPass /foo/bar mybackendservice.com/foo
ProxyPassReverse /foo/bar mybackendservice.com/foo

I did also try rewriting the url using:

RewriteEngine on

RewriteRule foo/bar foo [NC]

but this doesn't seeem to work. Is there another way of achieving this?

praetorian1
  • 173
  • 1
  • 13

1 Answers1

0

You need to use HTTP redirects instead of mod_rewrite.

Create a script which returns HTTP status 302 Found and specify HTTP Header Location: /foo

Anthony
  • 12,407
  • 12
  • 64
  • 88