Mercurial > hg > nginx
diff src/http/ngx_http_variables.c @ 5072:7fa7e60a7f66
Proxy: support for connection upgrade (101 Switching Protocols).
This allows to proxy WebSockets by using configuration like this:
location /chat/ {
proxy_pass http://backend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
Connection upgrade is allowed as long as it was requested by a client
via the Upgrade request header.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 18 Feb 2013 13:50:52 +0000 |
parents | 829cc5872186 |
children | a805dc9c85cd |
line wrap: on
line diff
--- a/src/http/ngx_http_variables.c Mon Feb 18 11:35:28 2013 +0000 +++ b/src/http/ngx_http_variables.c Mon Feb 18 13:50:52 2013 +0000 @@ -1747,7 +1747,11 @@ size_t len; char *p; - if (r->keepalive) { + if (r->headers_out.status == NGX_HTTP_SWITCHING_PROTOCOLS) { + len = sizeof("upgrade") - 1; + p = "upgrade"; + + } else if (r->keepalive) { len = sizeof("keep-alive") - 1; p = "keep-alive";