All checked? Be nice and have fun!
Elixir version (elixir -v): 1.2.2
I'm trying to force SSL on all connections to an app that can be deployed to different custom domains (currently on Heroku). I'm not setting up any host configuration for the app.
Based on Plug.SSL behaviour, I would expect that the connection's host would be used as a default when no custom domain has been configured in Phoenix.
The SSL redirection is actually working but I am being forced into https://localhost which is not the desired behaviour.
The fix seems to be around this line, but I may be missing something that this default accomplishes in another context. Any insight?
What happens if you explicitly set force_ssl: [host: nil]? Phoenix automatically copies the URL host, that's why you are seeing the behaviour you have described.
It worked beautifully.
I checked the source code but my standard lib foo didn't make me realize the put_new/3 was being used and I could trick it with a host: nil. Thanks a lot, and sorry for wasting your time ;)
I think this fix should be included in the docs, I went down quite the rabbit hole until finally finding this issue.
@sgtpepper43 please do send a PR! :D
Most helpful comment
I think this fix should be included in the docs, I went down quite the rabbit hole until finally finding this issue.