I tried to bind phoenix to "0.0.0.0"
I tried in config.exs
as:
config :app, App.Endpoint,
url: [host: "0.0.0.0"],
And, I tried in dev.exs
as:
config :app, App.Endpoint,
http: [host: "0.0.0.0", port: 4000],
but neither has worked:
[info] Running App.Endpoint with Cowboy using http://localhost:4000
[warn] Transport option {:host, "0.0.0.0"} unknown or invalid.
So, what's the correct way?
You need to use the ip
key for this in http
, with the value being a 4 element tuple of integers representing the IP. In your case, it would look like:
config :app, App.Endpoint,
http: [ip: {0, 0, 0, 0}, port: 4000]
Source
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