mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-04-24 08:41:31 +00:00
update the doc about websocket proxy
This commit is contained in:
parent
60bc1498ae
commit
c018c775c8
@ -84,6 +84,7 @@ const options = {
|
||||
},
|
||||
throttle: 10000,
|
||||
forceProxyHttps: false,
|
||||
wsIntercept: false, // 不开启websocket代理
|
||||
silent: false
|
||||
};
|
||||
const proxyServer = new AnyProxy.ProxyServer(options);
|
||||
@ -110,6 +111,7 @@ proxyServer.close();
|
||||
* `forceProxyHttps` {boolean} 是否强制拦截所有的https,忽略规则模块的返回,默认`false`
|
||||
* `silent` {boolean} 是否屏蔽所有console输出,默认`false`
|
||||
* `dangerouslyIgnoreUnauthorized` {boolean} 是否忽略请求中的证书错误,默认`false`
|
||||
* `wsIntercept` {boolean} 是否开启websocket代理,默认`false`
|
||||
* `webInterface` {object} web版界面配置
|
||||
* `enable` {boolean} 是否启用web版界面,默认`false`
|
||||
* `webPort` {number} web版界面端口号,默认`8002`
|
||||
|
@ -83,6 +83,7 @@ const options = {
|
||||
},
|
||||
throttle: 10000,
|
||||
forceProxyHttps: false,
|
||||
wsIntercept: false,
|
||||
silent: false
|
||||
};
|
||||
const proxyServer = new AnyProxy.ProxyServer(options);
|
||||
@ -106,11 +107,12 @@ proxyServer.close();
|
||||
* `port` {number} required, port number of proxy server
|
||||
* `rule` {object} your rule module
|
||||
* `throttle` {number} throttle in kb/s, unlimited for default
|
||||
* `forceProxyHttps` {boolean} in force intercept all https request, false for default
|
||||
* `silent` {boolean} if keep silent in console, false for default`false`
|
||||
* `dangerouslyIgnoreUnauthorized` {boolean} if ignore certificate error in request, false for default
|
||||
* `forceProxyHttps` {boolean} in force intercept all https request, default to `false`
|
||||
* `silent` {boolean} if keep silent in console, false for default `false`
|
||||
* `dangerouslyIgnoreUnauthorized` {boolean} if ignore certificate error in request, default to `false`
|
||||
* `wsIntercept` {boolean} whether to intercept websocket, default to `false`
|
||||
* `webInterface` {object} config for web interface
|
||||
* `enable` {boolean} if enable web interface, false for default
|
||||
* `enable` {boolean} if enable web interface, default to `false`
|
||||
* `webPort` {number} port number for web interface
|
||||
* Event: `ready`
|
||||
* emit when proxy server is ready
|
||||
|
@ -570,7 +570,7 @@ function getConnectReqHandler(userRule, recorder, httpsServerMgr) {
|
||||
// determine the request target
|
||||
if (!shouldIntercept) {
|
||||
// server info from the original request
|
||||
const orginServer = {
|
||||
const originServer = {
|
||||
host,
|
||||
port: (targetPort === 80) ? 443 : targetPort
|
||||
}
|
||||
@ -581,7 +581,7 @@ function getConnectReqHandler(userRule, recorder, httpsServerMgr) {
|
||||
}
|
||||
|
||||
// for ws request, redirect them to local ws server
|
||||
return interceptWsRequest ? localHttpServer : orginServer;
|
||||
return interceptWsRequest ? localHttpServer : originServer;
|
||||
} else {
|
||||
return httpsServerMgr.getSharedHttpsServer(host).then(serverInfo => ({ host: serverInfo.host, port: serverInfo.port }));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user