Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a apache web server that needs to reverse proxy a site. So example.com/test/ or example.com/test pull from the same other webserver. I have setup a reverse proxy for the one without the trailing slash like this:

ProxyPass /test http://othersite.com/test
ProxyPassReverse /testhttp://othersite.com/test

But it doesn't work with a trailing slash.

Any Ideas? I have tried redirecting from /test/ to /test with no luck.

Thanks.

share|improve this question
up vote 5 down vote accepted

Have you tried to rewrite the url?

RewriteEngine on 
RewriteRule ^/test$ /test/ [R]

ProxyRequests Off       
ProxyPreserveHost On

ProxyPass    /test/   http://othersite.com/test/
ProxyPassReverse /test/  http://othersite.com/test/
share|improve this answer

What do you mean it doesn't work with a trailing slash? Does it redirect to the wrong place? Does it give a 404 error? This is what I used to set up a reverse proxy and hide the source from the rest of the world.

ProxyRequests off
<Location /guides>
  ProxyPass http://blog.domain.com
  ProxyPassReverse http://blog.domain.com
  ProxyPassReverse /
  ProxyHTMLEnable On
  ProxyHTMLURLMap / /guides
  ProxyHTMLURLMap http://blogs.domain.com /guides
  RequestHeader unset Accept-Encoding
  RequestHeader set MySpecialHeader secretkey
  #LogLevel proxy:debug
</Location>

You can use this to test your proxy:

$ curl -I http://localhost:81/guides/top5
HTTP/1.1 301 Moved Permanently
Location: http://localhost:81/guides/top5/
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.