Hide 8080 on URL and redirect traffic from 80 to 8080
I got two enterprise applications running on the same mach开发者_高级运维ine and with JKMount I have managed to redirect traffic from 8081 to one of them and 8082 to another, but now I also need to deploy a Web service. I have deployed the Web service and it is accesible at http://localhost:8080/xyz/abcd?wsdl
.
I want to remove the port from the URL and make the traffic pass instead of 8080, on port 80 and to be redirected to 8080, because I already have another service running and occupying the port 80.
How can I do that by configuring Tomcat and GlassFish?
Note that only one process can listen to a specific port at the same time. So if there is already an application using port 80 you will have to configure a proxy for this application.
Or, alternatively, you set the blocking application to be listening to some other port and use a proxy.
If you have root access to the machine, you can use a proxy via Apache + mod_proxy or Cherokee, to redirect external requests on port 80 (or any other Apache-listening port) to some specific internal port (or even to ports on other servers).
iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -I OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
iptables -t nat -I OUTPUT -p tcp --dport 443 -j REDIRECT --to-ports 8443
精彩评论