New Feature: Automatic HTTPS redirects

Who doesn’t love a new feature? It’s now possible to configure HTTP → HTTPS redirects through fly.toml . Enabling it will return a HTTP response with a 301 status code and a redirect to the HTTPS standard port.

[[services.ports]]
  handlers = ["http"]
  port = 80
  force_https = true

An example response

HTTP/1.1 301 Moved Permanently
location: https://example.fly.dev/
...
...

All in a day’s work!

We’ve designed this feature with the most common use case in mind. It does not support redirecting to custom HTTPS ports, returning a different status code or redirecting specific requests. Our recommendation is to implement these in your application .

Happy HTTPS redirecting!

21 Likes

This is great!
Thank you so much for listening, once again, and shipping features quite fast.

1 Like

Awesome! Thanks Fly team! :tada:

1 Like

That’s very very useful, saved more than a days work!

3 Likes

this seems to work well when not redirecting from custom domain. But I found problems when using a godaddy domain of .com type. Maybe is just misunderstanding from my part, but I don’t really know how to solve this. Can you, or anyone else provide a way to force https in all parts, since when using http my applications does not work?

Awesome feature, I would like to know if it is possible to do this for WWW to NON WWW redirects (https:www.myapp.fly.dev → https:myapp.fly.dev), since it is affecting the SEO of my page, or if there is any other alternative (I tried with NGINX but I’m neither quite sure since I do not own the domain name). Thanks in advance!