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

Having these two rules works good:

ProxyPass / http://localhost:8080/app
ProxyPassReverse / http://localhost:8080/app

When client visits,, Apache calls app server and it works as expected.

Problem is that there is one directory, generated by the app server that I don't want to be prepended with /app.

For example: (actual case)  (this is how I want this)

Any ideas?

share|improve this question
I added answer, but it occurred to me ... is stuff in the app server linking to /app/styles/file.css or just /styles/file.css; the former may require rewriting the HTML on the file. – Foon Mar 4 '13 at 19:33
correct, first case, stuff in the app server. Can't rewrite it's coded on the app server, not in my code. – jacktrades Mar 4 '13 at 19:38
Oops... I meant on the fly, as in using mod_rewrite_html or whatever – Foon Mar 5 '13 at 0:52
To possibly help clarify, could you provide an example of WHY you don't want it to prepended by /app – Foon Mar 5 '13 at 3:35

I'm still not 100% sure which way your issue is. If you want it so that when the browser sees something like

<link rel="stylesheet" href="/styles/main.css" type="text/css" />

It requests the main.css file that tomcat hosts at /app/styles/main.css


ProxyPass /styles http://localhost:8080/app/styles
ProxyPassReverse /styles http://localhost:8080/app/styles

ProxyPass / http://localhost:8080/app
ProxyPassReverse / http://localhost:8080/app

Conversely, if you want it so that when the browser sees something like

<link rel="stylesheet" href="/apps/styles/main.css" type="text/css" />

It gets the main.css file that tomcat hosts at /styles/main.css


ProxyPass /apps/styles http://localhost:8080/styles
ProxyPassReverse /apps/styles http://localhost:8080/styles

ProxyPass / http://localhost:8080/app
ProxyPassReverse / http://localhost:8080/app

In either case, Apache will match in the order stuff appears in the config file.

share|improve this answer
Also note that if stuff in /styles/ is all static files, you could move it into your httpd wwwroot (e.g. /var/www/html) and do something like: ProxyPass /styles ! to cause it to serve it from Apache httpd instead of tomcat or whatever your app server is. – Foon Mar 4 '13 at 19:31
nope cannot do that either, it's dynamic content :( – jacktrades Mar 4 '13 at 19:39
You might need to combine rewrite with ProxyPass, or use another context under /app/ to use with ProxyPass. – Akber Choudhry Mar 4 '13 at 20:32

Your Answer


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.