vfsoraki
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 prod.exs from url: [host: "my.host", port: 80] to url: [host: "my.host", port: 443]. But now the urls are being generated like http://my.host:443/path.
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.
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #ai
- #graphql
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
NobbZ
Documentation of
Phoenix.EndpointsaysSo it should be enough to add
scheme: "https"to your:urlconfigvfsoraki
I really really have no idea how could I miss that!
Thanks mate.
dimitarvp
It’s
schemebtw. Caught me off-guard for a sec so figured I should warn future readers.ruudk
Thanks for pointing this out. I blindly copied @nobbZ’s suggestion and it didn’t work.
@NobbZ Can you please edit it?