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

lume -s does not listen on ipv6 #503

Open
4censord opened this issue Nov 4, 2023 · 4 comments
Open

lume -s does not listen on ipv6 #503

4censord opened this issue Nov 4, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@4censord
Copy link

4censord commented Nov 4, 2023

Version

v1.19.3

Platform

Linux (Linux thearch 6.5.9-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 26 Oct 2023 00:52:20 +0000 x86_64 GNU/Linux)

What steps will reproduce the bug?

Start lume with deno task serve

Try to connect to http://localhost:3000 using ipv6
(e.g. curl -6 localhost:3000)
Run into timeout

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior?

Lume should either

  • listen on ipv6 and ipv4 localhost
  • Output http://127.0.0.1:3000/ (local) instead of http://localhost:3000/ (local)

What do you see instead?

I run into a timeout trying to connect to lume using ipv6

Additional information

No response

@4censord 4censord added the bug Something isn't working label Nov 4, 2023
@oscarotero
Copy link
Member

I'm not familiarized with ipv6 so I have to dig into Deno server options.
Any help with this will be appreciated

@4censord
Copy link
Author

4censord commented Nov 6, 2023

The server is created here (https://github.com/lumeland/lume/blob/ecdafbf6c28cae91f1d6a573d888051ec1fb2407/core/server.ts#L81C1-L92C4)

The documentation does not mention anything about running dualstack (https://deno.land/[email protected]?s=Deno.ListenOptions)

Having it listen on only IPv6 is as simple as

diff --git a/core/server.ts b/core/server.ts
index d52936ef..d617a220 100644
--- a/core/server.ts
+++ b/core/server.ts
@@ -83,6 +83,7 @@ export default class Server {
 
     this.#server = new HttpServer({
       port: port,
+      hostname: "[::1]",
       handler: (request, connInfo) => this.handle(request, connInfo),
     });

That is all i could figure out by now. I've never worked with deno before, so i wouldnt even know where to look further.

@4censord
Copy link
Author

4censord commented Nov 6, 2023

Also, i now know why i says localhost instead of 127.0.0.1or similar, that is the recomendation in the docs, for windows reasons.

Note about 0.0.0.0 While listening 0.0.0.0 works on all platforms, the browsers on Windows don't work with the address 0.0.0.0. You should show the message like server running on localhost:8080 instead of server running on 0.0.0.0:8080 if your program supports Windows.

@oscarotero
Copy link
Member

oscarotero commented Nov 6, 2023

We are planning to switch to Deno.serve() which is more performant and will replace the old API, but I didn't see any option to listen two different hostnames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants