Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
5eebc434bb | |||
ed03c3ec4b |
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartproxy",
|
"name": "@pushrocks/smartproxy",
|
||||||
"version": "1.0.26",
|
"version": "1.0.27",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartproxy",
|
"name": "@pushrocks/smartproxy",
|
||||||
"version": "1.0.26",
|
"version": "1.0.27",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a proxy for handling high workloads of proxying",
|
"description": "a proxy for handling high workloads of proxying",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -97,8 +97,17 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
|
|||||||
}, async (req, res) => {
|
}, async (req, res) => {
|
||||||
console.log('got request');
|
console.log('got request');
|
||||||
const destinationConfig = this.router.routeReq(req);
|
const destinationConfig = this.router.routeReq(req);
|
||||||
|
let destinationUrl: string;
|
||||||
|
if (destinationConfig) {
|
||||||
|
destinationUrl = `http://${destinationConfig.destinationIp}:${destinationConfig.destinationPort}${req.url}`;
|
||||||
|
} else {
|
||||||
|
res.writeHead(404);
|
||||||
|
res.end('This route is not available on this server\n');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log(destinationUrl);
|
||||||
const response = await plugins.smartrequest.request(
|
const response = await plugins.smartrequest.request(
|
||||||
`http://${destinationConfig.destinationIp}:${destinationConfig.destinationPort}${req.url}`,
|
destinationUrl,
|
||||||
{
|
{
|
||||||
method: req.method,
|
method: req.method,
|
||||||
headers: req.headers
|
headers: req.headers
|
||||||
|
Reference in New Issue
Block a user