Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have my Apache Server running on port 80.

I also have a Geoserver running in Jetty on port 8080. To avoid cross domain problems in JavaScript, I wish that any request that comes to http://example.com/geoserver, is proxied to http://servername:8080/geoserver

I am currently using Virtual_host and mod_proxy to Do this. My httpd.conf has the following code:

<VirtualHost  *:80>
   ProxyPass /geoserver http://localhost:8080/geoserver
   ProxyPassReverse /geoserver http://localhost:8080/geoserver
</VirtualHost>

Now I need Apache to serve as a Reverse proxy for another application running with node.js on port 5000. If I add the following code in my http.conf:

<VirtualHost  *:80>
   ProxyPass /DocHub http://localhost:5000
   ProxyPassReverse /DocHub http://localhost:5000
</VirtualHost>

I get the following warning in the Apache Logs: _default_ VirtualHost overlap on port 80, the first has precedence. And the request to http://example.com/DocHub gives a 404 error.

Is there a way for Apache to serve as a Reverse Proxy for multiple sites? Is there another way of achieving what I want to do?

share|improve this question

1 Answer 1

This is how I got it to work. I'm not sure if this is the right way, or is the wrong way. Maybe someone more experienced with Apache can provide input.

Instead of Keeping them in separate VirtualHost Tags, put them in the same tag like this:

<VirtualHost  *:80>
   ProxyPass /geoserver http://localhost:8080/geoserver
   ProxyPassReverse /geoserver http://localhost:8080/geoserver
   ProxyPass /DocHub http://localhost:5000
   ProxyPassReverse /DocHub http://localhost:5000
</VirtualHost>

This seems to be working for me.

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.