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 a web application running on a Linux box using Tomcat6.

I have setup port forwarding so that any requests on port 80 get redirected to port 8080 which works fine.

The problem I have is that the web app makes calls to API's using HTTP (on port 80), so it is unable to send any requests or receive any requests because everything is directed to the web app on port 8080.

Is there any way to allow the server to send/receive on port 80, but external hosts (i.e. users of the web app) connecting to the server are directed to 8080.

Thanks

share|improve this question

migrated from stackoverflow.com Apr 21 '11 at 20:55

This question came from our site for professional and enthusiast programmers.

    
Please post the Script / Settings / Details of the Port forwarding. –  Stephan B Apr 20 '11 at 6:48

1 Answer 1

You might be able to use ProxyPass and ProxyPassReverse to proxy some url to 8080, and not do port forwarding.

Get rid of the port forwarding, and create a file in /etc/httpd/conf.d (assuming redhat based linux distro with apache):

ProxyPass /myapp/ http://localhost:8080/
ProxyPassReverse /myapp/ http://localhost:8080/

You can also put path after the http line above if needed.

This basically sets up a reverse proxy, so anything matching the ProxyPass{,Reverse} entries will go to localhost:8080, everything else will get served by the local apache instance.

Obviously if you have a different distro or os or webserver, the above would have to be altered, but the concept is the same.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.