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 .
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!
This is not working for me. I’m getting “Blocked loading mixed active content” errors and my page just shows up blank. Here is my fly.toml entry for http_service:
“Blocked loading mixed active content” is likely coming from your web browser. You may have images, CSS files and/or other external asserts from http://..., while the page itself is served from https://....