Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen on specific interface ? #46

Open
uggyuggy opened this issue Aug 14, 2020 · 2 comments
Open

Listen on specific interface ? #46

uggyuggy opened this issue Aug 14, 2020 · 2 comments

Comments

@uggyuggy
Copy link

Hi,
I see we can change the listening port with the PORT environment variable
What configuration change could be used to be able to change the listening interface.. and define a specific one (like 127.0.0.1) ?

Thank's !

@Fitblip
Copy link
Member

Fitblip commented Sep 7, 2020

Hi @uggyuggy, we currently set the port here

[{:port, get_port()}],

Which is passed into the :cowboy.start_clear function which initializes the webserver (cowboy). Tracing through things a bit (first https://ninenines.eu/docs/en/cowboy/2.5/manual/cowboy.start_clear, then https://ninenines.eu/docs/en/ranch/1.7/manual/ranch_tcp/), it looks like if you wanted to bind to a custom interface, you'd edit that line to look like this:

[{:port, get_port(), :ip, {127,0,0,1}}], 

Or something similar, replacing {127,0,0,1} with whatever your interface address is. Currently we don't have any way of configuring that via a environment variable, but PRs are always welcome!

@uggyuggy
Copy link
Author

Hi @Fitblip

Thank's for the informations and directions.
I tried to change as per your suggestion, but it seems to not work.

At the start the debug shows:
[warn] Transport option {:port, 4000, :ip, {127, 0, 0, 1}} unknown or invalid.
and this is not listening on the IP/Port.
I tried with few other syntax for this line, but no luck so far... I will continue to search..

And thank's again for you work and for sharing this tool 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants