-
Notifications
You must be signed in to change notification settings - Fork 8
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
✨(marsha) configure nginx to handle websocket #713
Conversation
apps/marsha/vars/all/main.yml
Outdated
@@ -15,6 +15,8 @@ marsha_nginx_status_endpoint: "/__status__" | |||
marsha_nginx_admin_ip_whitelist: [] | |||
marsha_nginx_bypass_htaccess_ip_whitelist: [] | |||
marsha_nginx_static_cache_expires: "1M" | |||
marsha_nginx_websocket_proxy_read_timeout: 86400 | |||
marsha_nginx_websocket_proxy_send_timeout: 86400 |
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.
Can you add a comment explaining why a 24h read/send timeout?
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.
Yes I can
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.
After tests, keeping the default value still work. The ping/pong implementation keeps alive the connection while the client is connected. I will remove all timeout but I keep the location
block in the nginx configuration to not mix webstocket and http requests.
nginx.ingress.kubernetes.io/proxy-read-timeout: "{{ marsha_nginx_websocket_proxy_read_timeout }}" | ||
nginx.ingress.kubernetes.io/proxy-send-timeout: "{{ marsha_nginx_websocket_proxy_send_timeout }}" |
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 configuration will impact all connections/locations received by nginx, No side effect is expected?
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.
By the ingress. And after in the nginx deploy with marsha we can reconfigure a lower timeout if needed. The first closing the connection will close the connection for all other proxies.
proxy_read_timeout {{ marsha_nginx_websocket_proxy_read_timeout }}; | ||
proxy_send_timeout {{ marsha_nginx_websocket_proxy_send_timeout }}; | ||
} | ||
|
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.
IMO you don't need a new location if you allow to upgrade connections for the /
location.
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 new location is needed to isolate websocket connection from others. For a classic http connection we don't want to allow a so big timeout. Only for websocket. So we must add this new location dedicated to websocket.
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.
One other argument to keep this location block is http/2
. The UvicornWorker is able to handle http2 and I see that browsers compatible are using this protocol
addec5f
to
1b6808a
Compare
@jmaupetit ready for a new review |
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.
CHANGELOG.md
Outdated
@@ -8,6 +8,10 @@ Versioning](http://semver.org/spec/v2.0.0.html). | |||
|
|||
## Unreleased | |||
|
|||
### Added | |||
|
|||
- Marsha: configure nginx to handle websockets |
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.
- Marsha: configure nginx to handle websockets | |
- Marsha: configure nginx to handle websockets in a dedicated location |
be1268e
to
db1bb68
Compare
Marsha supports websocket. We need to configure Nginx to handle this connection. All websockets begin with `/ws/`, a new location block is created responsible to deal with the Connection and Upgrade header.
db1bb68
to
3a4f526
Compare
Purpose
Marsha supports websocket. We need to configure Nginx to manage this
connection. All websockets begin with
/ws/
, a new location block iscreated responsible to deal with the Connection and Upgrade header
Proposal