Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to start phoenixframework at host 0.0.0.0?

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?

like image 893
simo Avatar asked Jun 12 '16 12:06

simo


1 Answers

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

like image 101
Dogbert Avatar answered Sep 27 '22 21:09

Dogbert