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 am running a WebApplication on a Servlet Container (port 8080) in an environment that can be accessed from the internet (external) and from company inside (intenal), e.g.

The incomming (external/internal) requests are redirected to the servlet container using an apache http server with mod_proxy. The configuration looks like this:

ProxyPass /MyApplication http://localhost:8080/MyApplication retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse /MyApplication http://localhost:8080/MyApplication

I am now facing the problem that some MyApplication responses depend on the original request URL. Concrete: a WSDL document will be provided with a element that has a schemaLocation="<RequestUrl>?xsd=MyApplication.xsd" element.

With my current configuration it always looks like

<xs:import namespace="..." schemaLocation="http://localhost:8080/MyApplication?xsd=MyApplication.xsd"/>

but it should be

External Request: <xs:import namespace="..." schemaLocation=""/>
Internal Request: <xs:import namespace="..." schemaLocation=""/>

I suppose this is a common requirement. But as I am no expert in configuration of the apache http server and its modules I would be glad if someone could give some (detailed) help.

Thanks in advance!

PS: I also posted this on stackoverflow but thought this might be the better place.

share|improve this question
up vote 2 down vote accepted

If you're running Apache >= 2.0.31 then you might try to set the ProxyPreserveHost directive as described here.

This should pass the original Host header trough mod_proxy into your application, and normally the request URL will be rebuild there (in your Servlet container) using the Host header, so the schema location should be build using the host and path infos from "before" the proxy.

share|improve this answer
This sounds good. I will try it next office day. +1 for the moment and thanks! – FrVaBe May 21 '11 at 4:37
That was exactly what I was looking for. If you post this answer also on my cross posting at stackoverflow I will accept your answer there too. – FrVaBe May 23 '11 at 18:36
You're welcome. (Also posted it at stackoverflow for the sake of completeness.) – jCoder May 23 '11 at 18:46

You should be able to do a mod_rewrite in apache to encode the full URL as a query parameter, or perhaps part of the fragment. How easy this might be depends on whether you might use one or the other as part of your incoming queries.

For example, might get rewritten to which then gets passed into the ProxyPass and then stripped out.

A bit of a hack, yes, and perhaps a little tricky to get rewrite and proxy to work in the right order and not interfere with each other, but it seems like it should work.

share|improve this answer

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.