Posts

Showing posts from November, 2015

Handling HTTPS Connection to Tomcat on AWS with AWS Load balancer

The problem You have an awesome Java app that is growing like crazy and you need to be on top of it. You will start spawning servers to scale horizontally and putting a reliable balancer in front. AWS ELB is a good one but it will not solve all your needs out of the box. You need to tweak it a little bit to fit your needs. Your app is secure, you have a SSL certificate installed but the problem is how do I redirect or force all HTTP traffic to HTTPS ? The approach Put an NGINX in each Tomcat instance. You will say.. another webserver ? yes, another one. Another point of failure but a very reliable one. Nginx is super reliable and has the smallest footprint I ever seen in a serious web server. (NodeJS is not a serious one, that is why people puts NGINX in front of it) NGINX Config NGINX will rewrite all requests to the ELB calling the HTTPS port utilizing status 301. server { listen 80; server_name myhost.com; # add ssl settings return 301 https://myhost.com$r...