Fwd: Config Guidance

vikrant singh vikrant.thakur at gmail.com
Wed Sep 23 18:22:28 UTC 2015

It seems I sent to wrong mailing list... got no response. So forwarding
this question at "nginx at nginx.org"
---------- Forwarded message ----------
From: vikrant singh <vikrant.thakur at gmail.com>
Date: Tue, Sep 22, 2015 at 12:38 PM
Subject: Config Guidance
To: nginx-forum at nginx.us

I have quick question on config. On my reverse proxy I need to serve both
web-socket and normal http request.

For websocket request I add following in request...

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_pass $servAdd;

And for normal ones I just do
proxy_pass $servAdd;

My question is how to unify these two in a single location directive? I can
identify a websocket request and add extra header in a if block. But as
using if is not recommended I am not sure if I should do that.

Any advise?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150923/1d1b1d44/attachment.html>

More information about the nginx mailing list