-
Notifications
You must be signed in to change notification settings - Fork 13
Support Websockets #314
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
Support Websockets #314
Conversation
src/server/server.ts
Outdated
| if (port) | ||
| return proxy.ws(req, socket, { target: `http://127.0.0.1:${port}` }) | ||
|
|
||
| server.listen(443) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong. You can't listen to port 443 AFTER websocket connection.
src/server/server.ts
Outdated
| return `${prefix}${domain}` === req.headers.host | ||
| }) || {} | ||
| if (port) | ||
| return proxy.ws(req, socket, { target: `http://127.0.0.1:${port}` }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't hardcode the ip address, you already got the ip address from the variable.
src/server/server.ts
Outdated
| const { ip, port }: ProxyMapping = | ||
| mappings.find(({ subDomain, domain }) => { | ||
| const prefix = subDomain ? `${subDomain}.` : '' | ||
| return `${prefix}${domain}` === req.headers.host |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return fullDomain === req.headers.host
src/server/server.ts
Outdated
| const mappings = getMappings() | ||
| const { ip, port }: ProxyMapping = | ||
| mappings.find(({ subDomain, domain, fullDomain }) => { | ||
| const prefix = subDomain ? `${subDomain}.` : '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefix is not an unused variable. please remove it
src/server/server.ts
Outdated
| const prefix = subDomain ? `${subDomain}.` : '' | ||
| return fullDomain === req.headers.host | ||
| }) || {} | ||
| if (port) return proxy.ws(req, socket, { target: `${ip}:${port}` }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please put back http://
Support Websockets
No description provided.