I have my phoenix app set up behind nginx. Nginx is serving https traffic.
I want emails from coherence to contain https urls like https://my_domain.com/..., but I can't figure out how to do so.
Here is my app's config:
config :my_app, MyApp.Endpoint,
http: [port: 8080],
url: [host: "my_domain.com", port: 443],
# ...
With this config, urls in emails are like this: my_domain.com:443/some_path. And when I remove port: 443, they became my_domain.com:8080/some_path. And adding force_ssl: [hsts: true] doesn't help too.
Of cource I could set url: [host: "my_domain.com", port: 80] and set nginx to redirect all http requests to port 443, but it seems wrong to me. I could edit email templates to force https urls, but this also seems wrong.
Or maybe using a proxy in front of an erlang app is not an erlang way and I just didn't get it yet?
You need to set scheme to "https". This should work:
config :my_app, MyApp.Endpoint,
http: [port: 8080],
url: [host: "my_domain.com", port: 443, scheme: "https"],
# ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With