<div dir="ltr"><div>Thanks for the recipe.<br><br></div><div> Just tried and now I am not able to get regular <br>HTTP working on port 80.<br><br></div><div> Has anybody ever got nginx websocket proxy working?<br><br></div>
<div> Thanks,<br></div><div><br></div>- Alder<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 9, 2013 at 11:19 AM, António P. P. Almeida <span dir="ltr"><<a href="mailto:appa@perusio.net" target="_blank">appa@perusio.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">At the http level:<div><div><br></div><div>map $http_upgrade $connection_upgrade {</div><div> default upgrade;</div>
<div> '' close;</div><div>}</div></div><div><br></div><div class="gmail_extra">
map $connection_upgrade $proxy_upstream_port {</div><div class="gmail_extra"> upgrade 81;</div><div class="gmail_extra"> close 80;</div><div class="gmail_extra">}</div><div class="gmail_extra"><br></div>
<div class="gmail_extra">Then at the location do:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra"> location / {</div><div class="gmail_extra"> proxy_http_version 1.1;</div><div class="gmail_extra">
proxy_set_header Upgrade $http_upgrade;</div><div class="gmail_extra"> proxy_set_header Connection $connection_upgrade;</div><div class="gmail_extra"> proxy_pass http://localhost:$proxy_upstream_port;</div>
<div class="gmail_extra"> }</div><div class="gmail_extra"> </div><div class="gmail_extra">Partly taken from <a href="http://nginx.org/en/docs/http/websocket.html" target="_blank">http://nginx.org/en/docs/http/websocket.html</a>.</div>
<div class="gmail_extra"><br></div><div>----appa<br><br></div>
<br><br><div class="gmail_quote"><div><div class="h5">On Thu, May 9, 2013 at 12:35 AM, Alder Network <span dir="ltr"><<a href="mailto:aldernetwork@gmail.com" target="_blank">aldernetwork@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr"><div>This must have been discussed before but I am new to nginx<br>and this forum. <br><br></div><div>I am upgrading to 1.4 to use its websocket proxy feature. <br></div><div>Say I have a websocket server running at port 81, so I want<br>
</div><div>to forward all websocket packets to port 81, and process<br></div><div>the rest at port 80. <br><br></div><div>Somehow the following conf doesn't work, anything missing?<br></div><div><br> server {<br> listen [::]:80 ipv6only=off; <br>
<br> location / {<br> regular_http_processing_directive;<br> <br> if ($http_upgrade = "websocket") {<br> proxy_pass <a href="http://localhost:81" target="_blank">http://localhost:81</a>; <br>
}<br><br> proxy_http_version 1.1;<br> proxy_set_header Upgrade websocket;<br> proxy_set_header Connection upgrade;<br> }<br> }<span><font color="#888888"><br>
</font></span></div><span><font color="#888888"><div><br></div>- Alder<br></font></span></div>
<br></div></div>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div></div>
<br>_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br></blockquote></div><br></div>