Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
04b13e53b9 | |||
f1a4fae704 | |||
5ee5147606 | |||
748c6e14e4 | |||
f018957de4 | |||
a6583b037c | |||
3ab4144c9a | |||
0d2885ace4 | |||
1723275215 | |||
977d8b0310 | |||
5bb065f82b | |||
942b812f97 |
13871
package-lock.json
generated
13871
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartproxy",
|
||||
"version": "3.0.36",
|
||||
"version": "3.0.42",
|
||||
"private": false,
|
||||
"description": "a proxy for handling high workloads of proxying",
|
||||
"main": "dist_ts/index.js",
|
||||
@ -16,17 +16,18 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.65",
|
||||
"@gitzone/tsrun": "^1.2.39",
|
||||
"@gitzone/tstest": "^1.0.73",
|
||||
"@pushrocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^18.6.3"
|
||||
"@types/node": "^18.7.8"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/lik": "^6.0.0",
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
"@pushrocks/smartpromise": "^3.1.7",
|
||||
"@pushrocks/smartrequest": "^2.0.9",
|
||||
"@pushrocks/smartrequest": "^2.0.10",
|
||||
"@pushrocks/smartstring": "^4.0.2",
|
||||
"@tsclass/tsclass": "^4.0.17",
|
||||
"@tsclass/tsclass": "^4.0.19",
|
||||
"@types/ws": "^8.5.3",
|
||||
"ws": "^8.8.1"
|
||||
},
|
||||
|
4341
pnpm-lock.yaml
generated
Normal file
4341
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartproxy',
|
||||
version: '3.0.36',
|
||||
version: '3.0.42',
|
||||
description: 'a proxy for handling high workloads of proxying'
|
||||
}
|
||||
|
@ -188,6 +188,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
method: originRequest.method,
|
||||
headers: {
|
||||
...originRequest.headers,
|
||||
'X-Forwarded-Host': originRequest.headers.host,
|
||||
'X-Forwarded-Proto': 'https'
|
||||
},
|
||||
keepAlive: true,
|
||||
@ -244,19 +245,16 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
);
|
||||
|
||||
// Enable websockets
|
||||
const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer });
|
||||
wss.on('connection', (ws: plugins.wsDefault) => {
|
||||
console.log('got connection for wsc');
|
||||
const wss = new plugins.ws.WebSocketServer({ server: this.httpsServer });
|
||||
wss.on('connection', (ws: plugins.wsDefault, reqArg) => {
|
||||
console.log(`got connection for wsc for ${reqArg.url}`);
|
||||
let wscConnectedDeferred: plugins.smartpromise.Deferred<plugins.wsDefault>;
|
||||
|
||||
ws.on('message', async (message) => {
|
||||
if (!wscConnectedDeferred) {
|
||||
wscConnectedDeferred = plugins.smartpromise.defer();
|
||||
const wsc = new plugins.wsDefault(this.router.routeWs(ws), {
|
||||
headers: {
|
||||
Host: ws.url,
|
||||
},
|
||||
});
|
||||
const parsedUrl = plugins.url.parse(reqArg.url);
|
||||
const wsc = new plugins.wsDefault(`${this.router.routeWs(reqArg)}${parsedUrl.path}`);
|
||||
|
||||
wsc.on('open', () => {
|
||||
wscConnectedDeferred.resolve(wsc);
|
||||
@ -283,8 +281,8 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
||||
});
|
||||
});
|
||||
});
|
||||
this.httpsServer.keepAliveTimeout = 61000;
|
||||
this.httpsServer.headersTimeout = 65000;
|
||||
this.httpsServer.keepAliveTimeout = 600 * 1000;
|
||||
this.httpsServer.headersTimeout = 600 * 1000;
|
||||
|
||||
this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
|
||||
this.socketMap.add(connection);
|
||||
|
@ -22,8 +22,8 @@ export class ProxyRouter {
|
||||
return correspodingReverseProxyConfig;
|
||||
}
|
||||
|
||||
public routeWs(ws: plugins.wsDefault) {
|
||||
const originalHost = plugins.url.parse(ws.url).host;
|
||||
public routeWs(wsReq: plugins.http.IncomingMessage) {
|
||||
const originalHost = plugins.url.parse(wsReq.url).host;
|
||||
const correspodingReverseProxyConfig = this.reverseProxyConfigs.find((reverseConfig) => {
|
||||
return reverseConfig.hostName === originalHost;
|
||||
});
|
||||
|
Reference in New Issue
Block a user