How to send all network traffic generated by tomcat/app_server to a proxy_host:port

beer9
beer9 used Ask the Experts™
on
I am using a appserver/tomcat in the AWS (amazon web service) which is in private subnet. There is code inside appserver which talk with external authentication service. Now I have a proxy/NAT server (proxy:port) which has direct connectivity to external services.

Using iptables, How can I send all the network traffic request generated by tomcat/appserver via proxy:port so that tomcat/appserver can reach external authentication services?

Thanks!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Exec Consultant
Distinguished Expert 2018
Commented:
you may want to check out the proxy setting for AWS iptables in /etc/sysconfig/iptables - note from the sharing that the below applies to all packets arriving from outside to any network interface. If you are running any applications on the same instance that need to talk to Tomcat on the HTTP port, you need to add another rule.
e.g. sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080

and it also stated to include the proxyPort attribute in your HTTP connector config in server.xml (in this case): <Connector port="8080" proxyPort="80" .../>
Just to share other using similar for more examples

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial