tg123 / websockify-nginx-module Goto Github PK
View Code? Open in Web Editor NEWEmbed websockify into Nginx (convert any tcp connection into websocket)
License: MIT License
Embed websockify into Nginx (convert any tcp connection into websocket)
License: MIT License
What you wrote is a plug-in for the client (websocket) to access the backstage TCP protocol server through nginx
spice-html5 + xSpice work together to provide a web based spice client similar to how noVNC + xVNC provide a web based VNC client.
The connection does not get passed through using the module. It does however pass through when using the standalone websockify.
Hi,
I'm seeing this in my nginx error log:
2014/06/27 13:22:37 [error] 1651#0: *425 ngx_http_websockify_send_with_encode: encode error! while proxying upgraded connection, client: 10.10.10.10, server: name.server.com, request: "GET /vnc/5002 HTTP/1.1", upstream: "websockify://127.0.0.1:5002", host: "name.server.com"
And this in the firefox console:
New state 'failed', was 'normal'. Msg: Disconnected: illegal hextile subencoding 201
nginx 1.6.0
CentOS 6.5 x86_64
Fedora 20 x86_64
It doesn't happen always, but more frequently in CentOS than Fedora.
Can you help me??
Are you planning on making a Dockerfile, so one could easily use this with other services whose APIs have to be translated to a websocket API?
How to save your log data entered in the terminal?
sniffing??
location /websockify {
websockify_pass 10.58.93.148:5901;
}
websocket:
socket = new WebSocket("ws://10.127.96.195:80/websockify");
浏览器:
http://10.127.96.195/websockify
访问access.log里都是400
does it support unix domain sockets?
websocket_server_write_frame_header函数建议返回头部长度,这样使用完这个函数可以得到dst应该偏移多少,比如如下
static ngx_inline int
websocket_server_write_frame_header(u_char *dst, u_char opcode,
size_t payload_length)
{
dst[0] = (u_char)((opcode & 0x0F) | 0x80);
if ( payload_length <= 125 ) {
dst[1] = (u_char)(payload_length);
return 2;
}
dst[1] = (u_char) 126;
*(u_short *)&(dst[2]) = htons((u_short)(payload_length));
return 4;
}
使用时:
...
int len = websocket_server_write_frame_header(dst, opcode, payload_length);
dst += len;
...
Hello.
I'm trying to build nginx source with this module included. Tried nginx 1.6.3 and 1.8.1.
For both versions, configure fails with message:
adding module in /tmp/nginx/websockify-nginx-module-master/
/tmp/nginx/websockify-nginx-module-master//config: line 7: auto/module: No such file or directory
(the double backslash makes no difference)
I'm using Docker image of CentOS 7 with upstream gcc and make.
I can successfully include other modules (ngx_http_auth_pam, nginx-sticky-module-ng) without trouble.
Removing the troublesome line 7 allows successful configuration (ngx 1.8.1), but I'm yet to see if the functionality is there.
|----------Internet-------------------|------------------intranet1-----------------------|--------------intranet2--------------|
1 2 3
client -----------------> server1(nginx-websockify) -----------------> server2(nginx-websockify) -----------------> Tcp server
<---------------- <---------------- <----------------
6 5 4
Are secure (TLS/SSL) WebSockets supported? If so, does the module handle the security and bridge unencrypted TCP traffic to the proxied server?
return 502 Bad Gateway, remove http2 from nginx listen work.
static ngx_int_t ngx_http_websockify_handler(ngx_http_request_t *r)
在这个函数里面。许多返回都不考虑ngx_pcalloc分配内存的释放?
Need to expose websocket port 5901 if start with docker?
The instructions for building are for a static module. Can it be built as a dynamic module
单独使用websockify进行转发代理是成功的,使用nginx内置websockify模块,提示协议错误。
127.0.0.1:64738 是聊天服务器
单独使用的代码:
websockify 64737 127.0.0.1:64738 --ssl-target -v --traffic --cert ./self.pem --key .self.pem
nginx配置:
server {
listen 443 ssl;
server_name voice.example.com;
ssl_certificate /etc/letsencrypt/live/voice.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/voice.example.com/privkey.pem;
location /chat{
proxy_pass http://127.0.0.1:64737;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
以上是独立使用websockify是运行成功的。
下面是根据本模块的用的配置:
server {
listen 443 ssl;
server_name voice.example.com;
ssl_certificate /etc/letsencrypt/live/voice.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/voice.example.com/privkey.pem;
location /chat {
websockify_pass 127.0.0.1:64738;
}
}
使用内置服务器提示错误:
2018-03-27 23:30:47.746 1 => <31:(-1)> New connection: 127.0.0.1:29758
2018-03-27 23:30:47.762 1 => <31:(-1)> Connection closed: Error during SSL handshake: error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol [13]
这是啥原因呢?用内置模块就简单方便了很多,但是目前运行不起来。
nginx版本是 1.10.1,下面是编译配置:
--prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-openssl=../openssl-1.0.2h --with-pcre=../pcre-8.38 --with-pcre-jit --with-ld-opt='-ljemalloc' --add-module=../websockify-nginx-module/
need this options.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.