Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 am configuring an Apache HTTP server so it reverse proxies requests starting with /app/ to an eXist-db instance running in a Tomcat server, on port 8082. This port has been closed in the firewall and is inaccessible to the outer world. Following the eXist documentation, I have following rules in place in my httpd.conf file:

ProxyPass           /apps/  http://localhost:8082/
ProxyPassReverse    /apps/  http://localhost:8082/
ProxyPassReverseCookiePath /apps/ /

All goes well for requests to e.g. 'http://mydomain/apps/exist/index.xml'. Yet, the webstart client (accessible at 'http://localhost:8082/exist/webstart/exist.jnlp' on the web server) doesn't work behind the proxy. While 'http://mydomain/apps/exist/webstart/exist.jnlp' does generate a valid exist.jnlp file, that file can't be executed. The reason seems quite obvious: apparently, the eXist-db instance generating the exist.jnlp file only sees the proxied request as: 'http://localhost:8082/exist/webstart/exist.jnlp'. Yet, since the exist.jnlp file is executed on the client, that reference is meaningless (unless the client computer happens to have an eXist-db instance running on that port). Executing the exist.jnlp file hence fails with a 'connection refused' error.

Yet, there's no problem at all connecting a local eXist-db Java client to the proxied eXist instance with the URL xmldb:exist://mydomain/apps/exist/xmlrpc. The problem lies in generating the webstart exist.jnlp file, which seems to need access to a publicly accessible URL. However, opening port 8082 and replacing the Proxy references to 'http://localhost:8082' with 'http://mydomain:8082' IMO rather destroys the point of reverse proxying.

Do others have had success reverse proxying eXist-db on a closed port behind Apache? Are there perhaps some Proxy configuration settings I have overlooked (I'm no expert at all) that can make eXist see the original request instead of the proxied one?

Kind regards,


share|improve this question
up vote 0 down vote accepted

You want ProxyPreserveHost On, which sends the same Host: header it received to the back-end server. More info here.

share|improve this answer
Thanks a lot, Kyle! This works when all requests are proxied ('/' instead of '/apps/') in the Proxy rules. Yet, when I try to proxy requests for mydomain/apps/exist/webstart.jnlp to localhost:8082/exist/webstart.jnlp using above mod_proxy rules, with the addition of "ProxyPreserveHost On", it still fails. Apparently, the request then ends up with mydomain/exist/webstart/exist.jnlp, instead of mydomain/apps/exist/webstart/exist.jnlp. The same pattern occurs with eXist-internal rewrites, where the /apps/ part is omitted from the final URL. Do you know how to fix this? – rvdb Mar 29 '12 at 11:58
Well, that's because the user is requesting /exist/webstart/..., so I'm not sure how you'd modify the Host: header on the way through. – Kyle Smith Mar 29 '12 at 13:46
Yes, but with 'ProxyPreserveHost off', internal redirection by the eXist-db app does work: mydomain/apps/exist/eXide properly redirects to mydomain/apps/exist/eXide/index.html. With 'ProxyPreserveHost on', the same request suddenly redirects to mydomain/exist/eXide/index.html. The difference seems frustratingly subtle... – rvdb Mar 29 '12 at 14:31

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.