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


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.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel