Remove port from Router url Helpers?

My Endpoint is configured like this:

config :my_web, MyWeb.Endpoint,
    url: [host: "", scheme: "https"],
    http: [port: 5000]

I am serving the phoenix app at localhost port 5000, and have nginx as https server in front of it.

Currently pages load correctly and everything. However, I’m trying to use the MyWeb.Router.Helpers.url helpers and instead of
it is returning

How can I get it to not include the port? I tried setting port: nil in the Endpoint config, but that didn’t help.

1 Like

I found it. Had to use port: 443

config :my_web, MyWeb.Endpoint,
    url: [host: "", scheme: "https", port: 443],
    http: [port: 5000]

Now MyWeb.Router.Helpers.url(MyWeb.Endpoint) is returning


I ran into this as well—thanks for posting your solution. It seems that the url config port fallback to http config port is not documented.


same here :slight_smile: Thanks for the hining solution :slight_smile: