Web app only accessible via HTTPS

Hello everyone,
I have a web app in production and generated SSL certificates for it.
The problem is, I can only access the domain with https, which means if I only type “example.com” in the url, it doesn’t redirect to the https version and the site can’t be reached.
So if I want to access the website for the first time, I always have to manually type “https”. I notice that once accessed on that particular browser, I can finally type the domain name in the url normally without “https”.
It just bothers me because customers shouldn’t have to bother doing those steps.
I note that I have force_ssl: [hsts: true] in my endpoint config.
Thanks.

can you try in under config :backend, BackendWeb.Endpoint, to force_ssl: [rewrite_on: [:x_forwarded_proto]] in prod.exs

2 Likes

Thank you for your answer :+1: , I’m gonna try it right away and tell my customers to check their browsers for irregular behaviors.

The http → https rewrite usually happens in the reverse proxy (if you use one) or application hosting layer (fly.io does it). If you run your app without a reverse proxy and on a bare VPS then you need to do it yourself, as @hassanRsiddiqi has mentioned.