comparison src/http/modules/ngx_http_proxy_module.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 bbdb172f0927
children f7fe817c92a2
comparison
equal deleted inserted replaced
5071:e14b49c12a73 5072:7fa7e60a7f66
1470 || ctx->head 1470 || ctx->head
1471 || (!u->headers_in.chunked 1471 || (!u->headers_in.chunked
1472 && u->headers_in.content_length_n == 0)) 1472 && u->headers_in.content_length_n == 0))
1473 { 1473 {
1474 u->keepalive = !u->headers_in.connection_close; 1474 u->keepalive = !u->headers_in.connection_close;
1475 }
1476
1477 if (u->headers_in.status_n == NGX_HTTP_SWITCHING_PROTOCOLS) {
1478 u->keepalive = 0;
1479
1480 if (r->headers_in.upgrade) {
1481 u->upgrade = 1;
1482 }
1475 } 1483 }
1476 1484
1477 return NGX_OK; 1485 return NGX_OK;
1478 } 1486 }
1479 1487