Rocket icon indicating copy to clipboard operation
Rocket copied to clipboard

Listen to non-local addresses

Open paulhilbert opened this issue 8 years ago • 2 comments

Version: 0.3.15 OS: Arch Linux

My problem: I have trouble getting the basic example in the guide to run. Listening in development mode on localhost works locally as expected:

curl [::1]:8000/hello/whatever/14

gives a correct answer. However from the same network

curl hostname:8000/hello/whatever/14

does not (connection refused). Name resolution, pinging and ssh'ing works just fine. Specifying the exact IP also refuses my connection:

curl [fe80::988f:ceff:fed8:ebb2]:8000/hello/whatever/14
curl [fe80::988f:ceff:fed8:ebb2%interface]:8000/hello/whatever/14

Now this is kind of to be expected, given that localhost probably means that rocket listens on [::1/128], however this:

[development]
address = "::/0"
port = 8000

results in

Error: development.address key could not be parsed
    => in "/home/[username]/backend/Rocket.toml"
    => expected value to be a valid hostname or IP, but found string

Fun fact: 0.0.0.0 is allowed.

I don't know if this is hyper related or just a wrong assumption on my end. This networking setup works just fine with other http servers. There is no firewall present.

Reproducability: Apart from the minor experiments with the Rocket.toml I copied the hello world example verbatim.

Best, Richard

paulhilbert avatar Aug 12 '18 12:08 paulhilbert

That's not a valid IP; that's an IP range. Try ::.

SergioBenitez avatar Aug 13 '18 04:08 SergioBenitez

Thank you, that's it - didn't know :: without a prefix length was even a valid IP...

paulhilbert avatar Aug 13 '18 08:08 paulhilbert