Welcome! Log In Create A New Profile

Advanced

NGINX to support websocket client on the same port

August 31, 2016 01:21AM
A quick question, Does Nginx support websocket client.

I have a webserver that uses NGINX and i use a websocket server for which NGINX acts as proxy. In the same port , can i use websocket client to initiate a connection with the external websocket server?

config is here

worker_processes 1;

#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;

#pid logs/nginx.pid;


events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;

keepalive_timeout 65;


map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

upstream websocket {
server 192.168.5.16:8080;
}
server {
listen 9080;
server_name localhost;


location / {
root html;
index index.html index.htm;
}

location /socket {
proxy_pass http://websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /test{
hello_world;
}
}
Subject Author Posted

NGINX to support websocket client on the same port

jebina August 31, 2016 01:21AM

Re: NGINX to support websocket client on the same port

Valentin V. Bartenev August 31, 2016 06:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 305
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