Yep, to proxy Websockets with nginx, you need to be using at least
version nginx version 1.4, and add the following rules:


         proxy_http_version 1.1;
         proxy_set_header X-Forwarded-For $remote_addr;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";

As a practical example, I have the following block in my nginx configs
for each of my apps that run websockets:


     location / {
         proxy_pass http://127.0.0.1:8020;
         proxy_set_header Host $host;
         # WebSocket support (nginx 1.4)
         proxy_http_version 1.1;
         proxy_set_header X-Forwarded-For $remote_addr;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection "upgrade";
    }

On Thu, Apr 16, 2015 at 11:12 PM, Kai Janson <[email protected]> wrote:
> You can use a firewall rule for that, too.
>
> Sent from my iPhone
>
> On Apr 5, 2015, at 15:18, [email protected] wrote:
>
> Hello,
>
> I have a CB app using cowboy and websockets and getting ready for
> production. Maybe this is a obvious question but i couldnt find the
> solution.
> Is it possible to set nginx in front of a CB app working with cowboy
> webserver?
> I need this because i need to forward my domain to 8001 port. Domain only
> works with example: mydomain.com:8001
> Any sources or before implementation would be great.
>
> Thanks
> Mert
>
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/f877f57e-ca3d-4e43-913c-6992e36e50ee%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/4A001F4B-7325-43CB-BC25-815C29F954DF%40gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/CAPTXyXdR2wXTQQfoy%3Dijx3swTUD5wKb6oP-gYZ1aJx-Kx7MJCA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to