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
Bug: deno serve --host localhost
prints invalid URL
#23650
Comments
@marvinhagemeister is this Linux or Mac? It looks like the socket address is being resolved here which is a bit strange. |
@mmastrac I'm on macOS |
Turns out that the issue can be reproduced with Deno.serve({ hostname: "localhost" }, () => new Response("foo")); Output: $ deno run -A foo.ts
Listening on http://::1:8000/ |
@marvinhagemeister What do you have in I wonder if this is a weird IPv6 resolution thing. |
The default host file on macOS looks like this: ##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost |
Just ran into this on Windows. In v1.42.3 it prints localhost and in 1.43.1 it prints "::1" Deno.serve({
hostname: "localhost",
onListen(details) {
console.log(details);
},
}, (request) => {
return new Response(null);
}) |
It also occurs on Linux and Mac: https://github.com/dsherret/dax/actions/runs/8951547585/job/24587971522 |
Seems to also occur with // index.ts
Deno.serve({ hostname: "localhost" }, /* handler */); Then As an aside, pasting the given URL into Firefox results in a web search, rather than an attempt to connect to the local webserver as expected. According to RFC2732, the URL should instead be rendered as |
When passing
--host localhost
todeno serve
, the CLI will print an invalid URL:http://::1:8000/
Steps to reproduce
Then run
deno serve --host localhost main.ts
CLI output
Version: Deno 1.43.1
The text was updated successfully, but these errors were encountered: