30x / k8s-router

A general purpose router for Kubernetes.
Apache License 2.0
15 stars 2 forks source link

Add configuration for WebSocket support #29

Closed whitlockjc closed 8 years ago

whitlockjc commented 8 years ago

Per the nginx documentation:

As noted above, hop-by-hop headers including “Upgrade” and “Connection” are not passed from a client to proxied server

I propose we have some configuration to enable WebSocket support (and subsequent nginx configuration). Please see the following for more details on nginx and WebSockets: http://nginx.org/en/docs/http/websocket.html

whitlockjc commented 8 years ago

For the short term, let's add a new annotation called websocketPaths and use that.

arghya commented 8 years ago

For our edge router we did this:

proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_header;

Something similar could be done, so that these headers are added if the previous hop sends these.

whitlockjc commented 8 years ago

I'm not asking for implementation details, that's already documented in the link I provided in the issue. I'm asking how should we mark paths as being a WebSocket path? Do we extend the existing path syntax? Do we add a new annotation, like websocketPaths?

theganyo commented 8 years ago

Is it possible to just add those options to all public paths? If so, what's the downside?

theganyo commented 8 years ago

And actually, do private paths also need to be able to enable those options?

whitlockjc commented 8 years ago

I thought about adding it to all paths but mucking with those automatically seems like it could cause issues, especially if we do this the nginx way and downgrade/upgrade the connection to HTTP/1.1 for all connections.

theganyo commented 8 years ago

Hmm. "Seems like it could?" I think I wouldn't add the complexity until there's some evidence that it would cause a problem.

whitlockjc commented 8 years ago

What I ended up doing was enabling this without needing to annotate your Pods...for now.