mirror of
https://github.com/bitinflow/server.git
synced 2026-03-13 13:35:53 +00:00
remove http-proxy dependency
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
"book": "1.3.3",
|
"book": "1.3.3",
|
||||||
"debug": "3.1.0",
|
"debug": "3.1.0",
|
||||||
"express": "4.14.0",
|
"express": "4.14.0",
|
||||||
"http-proxy": "1.14.0",
|
|
||||||
"localenv": "0.2.2",
|
"localenv": "0.2.2",
|
||||||
"on-finished": "2.3.0",
|
"on-finished": "2.3.0",
|
||||||
"optimist": "0.6.1",
|
"optimist": "0.6.1",
|
||||||
|
|||||||
26
server.js
26
server.js
@@ -3,7 +3,6 @@ import express from 'express';
|
|||||||
import tldjs from 'tldjs';
|
import tldjs from 'tldjs';
|
||||||
import on_finished from 'on-finished';
|
import on_finished from 'on-finished';
|
||||||
import Debug from 'debug';
|
import Debug from 'debug';
|
||||||
import http_proxy from 'http-proxy';
|
|
||||||
import http from 'http';
|
import http from 'http';
|
||||||
import Promise from 'bluebird';
|
import Promise from 'bluebird';
|
||||||
|
|
||||||
@@ -13,21 +12,6 @@ import BindingAgent from './lib/BindingAgent';
|
|||||||
|
|
||||||
const debug = Debug('localtunnel:server');
|
const debug = Debug('localtunnel:server');
|
||||||
|
|
||||||
const proxy = http_proxy.createProxyServer({
|
|
||||||
target: 'http://localtunnel.github.io'
|
|
||||||
});
|
|
||||||
|
|
||||||
proxy.on('error', function(err) {
|
|
||||||
log.error(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
proxy.on('proxyReq', function(proxyReq, req, res, options) {
|
|
||||||
// rewrite the request so it hits the correct url on github
|
|
||||||
// also make sure host header is what we expect
|
|
||||||
proxyReq.path = '/www' + proxyReq.path;
|
|
||||||
proxyReq.setHeader('host', 'localtunnel.github.io');
|
|
||||||
});
|
|
||||||
|
|
||||||
const PRODUCTION = process.env.NODE_ENV === 'production';
|
const PRODUCTION = process.env.NODE_ENV === 'production';
|
||||||
|
|
||||||
// id -> client http server
|
// id -> client http server
|
||||||
@@ -252,16 +236,6 @@ module.exports = function(opt) {
|
|||||||
res.redirect('https://localtunnel.github.io/www/');
|
res.redirect('https://localtunnel.github.io/www/');
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO(roman) remove after deploying redirect above
|
|
||||||
app.get('/assets/*', function(req, res, next) {
|
|
||||||
proxy.web(req, res);
|
|
||||||
});
|
|
||||||
|
|
||||||
// TODO(roman) remove after deploying redirect above
|
|
||||||
app.get('/favicon.ico', function(req, res, next) {
|
|
||||||
proxy.web(req, res);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/api/status', function(req, res, next) {
|
app.get('/api/status', function(req, res, next) {
|
||||||
res.json({
|
res.json({
|
||||||
tunnels: stats.tunnels,
|
tunnels: stats.tunnels,
|
||||||
|
|||||||
15
yarn.lock
15
yarn.lock
@@ -465,10 +465,6 @@ etag@~1.7.0:
|
|||||||
version "1.7.0"
|
version "1.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8"
|
resolved "https://registry.yarnpkg.com/etag/-/etag-1.7.0.tgz#03d30b5f67dd6e632d2945d30d6652731a34d5d8"
|
||||||
|
|
||||||
eventemitter3@1.x.x:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-1.2.0.tgz#1c86991d816ad1e504750e73874224ecf3bec508"
|
|
||||||
|
|
||||||
express@4.14.0:
|
express@4.14.0:
|
||||||
version "4.14.0"
|
version "4.14.0"
|
||||||
resolved "https://registry.yarnpkg.com/express/-/express-4.14.0.tgz#c1ee3f42cdc891fb3dc650a8922d51ec847d0d66"
|
resolved "https://registry.yarnpkg.com/express/-/express-4.14.0.tgz#c1ee3f42cdc891fb3dc650a8922d51ec847d0d66"
|
||||||
@@ -635,13 +631,6 @@ http-errors@~1.5.0, http-errors@~1.5.1:
|
|||||||
setprototypeof "1.0.2"
|
setprototypeof "1.0.2"
|
||||||
statuses ">= 1.3.1 < 2"
|
statuses ">= 1.3.1 < 2"
|
||||||
|
|
||||||
http-proxy@1.14.0:
|
|
||||||
version "1.14.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.14.0.tgz#be32ab34dd5229e87840f4c27cb335ee195b2a83"
|
|
||||||
dependencies:
|
|
||||||
eventemitter3 "1.x.x"
|
|
||||||
requires-port "1.x.x"
|
|
||||||
|
|
||||||
http-signature@~0.11.0:
|
http-signature@~0.11.0:
|
||||||
version "0.11.0"
|
version "0.11.0"
|
||||||
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-0.11.0.tgz#1796cf67a001ad5cd6849dca0991485f09089fe6"
|
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-0.11.0.tgz#1796cf67a001ad5cd6849dca0991485f09089fe6"
|
||||||
@@ -1269,10 +1258,6 @@ request@2.65.0:
|
|||||||
tough-cookie "~2.2.0"
|
tough-cookie "~2.2.0"
|
||||||
tunnel-agent "~0.4.1"
|
tunnel-agent "~0.4.1"
|
||||||
|
|
||||||
requires-port@1.x.x:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
|
|
||||||
|
|
||||||
resolve@^1.0.0:
|
resolve@^1.0.0:
|
||||||
version "1.5.0"
|
version "1.5.0"
|
||||||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
|
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"
|
||||||
|
|||||||
Reference in New Issue
Block a user