Question

What's needed for HTTP->HTTPS redirect in load balancer?

I’m using a couple of load balancers in front of my droplets and I only want to allow HTTPS traffic to the LB. There’s an option in the load balancer to “Redirect HTTP to HTTPS” that supposedly should redirect all calls on the 80 port on the load balancer to port 443?

This doesn’t seem to work as I get a “connection refused on port 80” when I access the droplet through the loadbalancer over http.

Is there some additional configuration needed for this redirect to work?


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
October 2, 2019
Accepted Answer

Hello,

Yes, it is possible to force the HTTP to HTTPS redirect. You can follow the steps on how to do that here:

https://www.digitalocean.com/docs/networking/load-balancers/how-to/ssl-termination/#force-ssl-traffic

Hope that this helps! Regards, Bobby

Thanks @bobbyiliev, that’s what I’ve done but when I test it out with curl http://domain.com I get a connection refused error for port 80. Using https works as expected.

I have configured a firewall blocking public access to port 80 the droplets from the internet, but I suppose that shouldn’t affect the redirecting, which should happen in the load balancer.

I must be doing something wrong, but can’t see what that would be.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.