-
Notifications
You must be signed in to change notification settings - Fork 134
Add nginx websocket locations for v2 extensions #3947
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -485,6 +485,16 @@ def setup_nginx_route(metadata: ServiceMetadata, port: int) -> bool: | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| }} | ||
|
|
||
| location /extensionv2/{name}/ws {{ | ||
| proxy_pass http://127.0.0.1:{port}/ws; | ||
| proxy_set_header Upgrade $http_upgrade; | ||
| proxy_set_header Connection "upgrade"; | ||
| proxy_set_header Host $host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Proto $scheme; | ||
| }} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be interesting to have the following lines for CORS conflicts. Add the following line for websocket upgrade:
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @patrickelectric , Thanks for the review.
Do you want me to include this in the default extension v2 location or just for the websocket location block? And do you think I should make the websocket location block nested inside the other block? To reduce duplicate headers?
Will do! |
||
| """ | ||
| filename = f"/home/pi/tools/nginx/extensions/{name}.conf" | ||
| Path.mkdir(Path("/home/pi/tools/nginx/extensions/"), parents=True, exist_ok=True) | ||
|
|
||
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.
issue (bug_risk): Add
proxy_http_version 1.1;in the WebSocket location to ensure Upgrade works reliably.Without explicitly setting HTTP/1.1 in this
locationblock, some setups can fall back to HTTP/1.0 semantics and ignore theUpgrade/Connectionheaders, leading to intermittent WebSocket failures. Please add:inside
location /extensionv2/{name}/ws.