Skip to content

not possible to start server listen on ports 80/443 #164

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

Open
tim-2 opened this issue Jan 7, 2025 · 1 comment
Open

not possible to start server listen on ports 80/443 #164

tim-2 opened this issue Jan 7, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@tim-2
Copy link

tim-2 commented Jan 7, 2025

If you start node lib/index.js server -l http://*:80 -l https://*:443 the server does not listen on ports 80/443, but on random ports instead.

On this line an URL is created from the listen location, but the ports 80 and 443 are set to an empty string in the URL object if the protocol is http/https:

new URL('http://localhost:80').port === ""
new URL('https://localhost:443').port === ""

Then the check in this line fails and no port is returned from listenArgsForURL which results in a random port.

I think there should be some checks like this:

if(port === '' and protocol === 'http:') port = 80;
if(port === '' and protocol === 'https:') port = 443;

Or am I doing something wrong?

@kraih
Copy link
Member

kraih commented Jan 8, 2025

Seems like a bug.

@kraih kraih added the bug Something isn't working label Jan 8, 2025
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