Welcome! Log In Create A New Profile

Advanced

Re: Websocket proxy

Alder Network
May 09, 2013 05:52PM
Thanks for the recipe.

Just tried and now I am not able to get regular
HTTP working on port 80.

Has anybody ever got nginx websocket proxy working?

Thanks,

- Alder


On Thu, May 9, 2013 at 11:19 AM, António P. P. Almeida <appa@perusio.net>wrote:

> At the http level:
>
> map $http_upgrade $connection_upgrade {
> default upgrade;
> '' close;
> }
>
> map $connection_upgrade $proxy_upstream_port {
> upgrade 81;
> close 80;
> }
>
> Then at the location do:
>
> location / {
> proxy_http_version 1.1;
> proxy_set_header Upgrade $http_upgrade;
> proxy_set_header Connection $connection_upgrade;
> proxy_pass http://localhost:$proxy_upstream_port;
> }
>
> Partly taken from http://nginx.org/en/docs/http/websocket.html.
>
> ----appa
>
>
>
> On Thu, May 9, 2013 at 12:35 AM, Alder Network <aldernetwork@gmail.com>wrote:
>
>> This must have been discussed before but I am new to nginx
>> and this forum.
>>
>> I am upgrading to 1.4 to use its websocket proxy feature.
>> Say I have a websocket server running at port 81, so I want
>> to forward all websocket packets to port 81, and process
>> the rest at port 80.
>>
>> Somehow the following conf doesn't work, anything missing?
>>
>> server {
>> listen [::]:80 ipv6only=off;
>>
>> location / {
>> regular_http_processing_directive;
>>
>> if ($http_upgrade = "websocket") {
>> proxy_pass http://localhost:81;
>> }
>>
>> proxy_http_version 1.1;
>> proxy_set_header Upgrade websocket;
>> proxy_set_header Connection upgrade;
>> }
>> }
>>
>> - Alder
>>
>> _______________________________________________
>> nginx mailing list
>> nginx@nginx.org
>> http://mailman.nginx.org/mailman/listinfo/nginx
>>
>
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Websocket proxy

Alder Network May 08, 2013 06:38PM

Re: Websocket proxy

António P. P. Almeida May 09, 2013 02:20PM

Re: Websocket proxy

Alder Network May 09, 2013 05:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 267
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready