Home > Uncategorized > Apache Trailing Slash Problem

Apache Trailing Slash Problem

I was helping our IT guys out this past weekend configuring a reverse proxy load balancing environment for JBoss/Tomcat behind Apache. I kept running into problems where requests coming from Apache looked like:
GET /foo//bar instead of GET /foo/bar

Unfortunately this was causing NPEs and resource not found errors in a third party servlet filter we are using to combine some our static resources. This is the Apache configuration that seems to have resolved the problem, I just wanted to post it here in case I ran up against it again.

# Placed in Apache conf for the site
<Proxy balancer://app_cluster >
BalancerMember http://app1/foo
BalancerMember http://app2/foo
BalancerMember http://app3/foo
</Proxy>
ProxyPass /foo/ balancer://app_cluster/ stickysession=JSESSIONID
ProxyPassReverse /foo/ http://app1/foo/
ProxyPassReverse /foo/ http://app2/foo/
ProxyPassReverse /foo/ http://app3/foo/

The lesson here is attention to detail, especially your final slashes.

Categories: Uncategorized Tags: ,
  1. JamesD
    June 11th, 2009 at 02:04 | #1

    Thanks for the useful info. It’s so interesting

  2. June 12th, 2009 at 20:25 | #2

    The article is ver good. Write please more

  3. June 13th, 2009 at 20:11 | #3

    The article is usefull for me. I’ll be coming back to your blog.

  1. No trackbacks yet.