I have a Phoenix 1.3 app that is running behind an Nginx reverse proxy, all in HTTP.
I wanted to migrate to HTTPS, so I got a certificate from Let’s Encrypt and changed Nginx config to do it. All worked fine.
I generate a bunch of urls inside my Phoenix app, using
MyApp.Web.Router.Helpers.*, but they generate HTTP urls. So I channged my app config in
url: [host: "my.host", port: 80] to
url: [host: "my.host", port: 443]. But now the urls are being generated like
How can I tell Phoenix to stay on HTTP, but generate urls in HTTPS?
PS. If I was not clear, I don’t want my Nginx and Phoenix to talk over HTTPS, I just want Phoenix url helpers to generate HTTPS urls. I have already read Endpoint configuration, but I could not find something useful.