From ab9b47d2b3790a11a7574821bcf33596bb645357 Mon Sep 17 00:00:00 2001 From: Roman Shtylman Date: Sun, 10 Dec 2017 10:27:03 -0800 Subject: [PATCH] remove http-proxy dependency --- package.json | 1 - server.js | 26 -------------------------- yarn.lock | 15 --------------- 3 files changed, 42 deletions(-) diff --git a/package.json b/package.json index 99905de..5280deb 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "book": "1.3.3", "debug": "3.1.0", "express": "4.14.0", - "http-proxy": "1.14.0", "localenv": "0.2.2", "on-finished": "2.3.0", "optimist": "0.6.1", diff --git a/server.js b/server.js index 8e5f6f0..36104f1 100644 --- a/server.js +++ b/server.js @@ -3,7 +3,6 @@ import express from 'express'; import tldjs from 'tldjs'; import on_finished from 'on-finished'; import Debug from 'debug'; -import http_proxy from 'http-proxy'; import http from 'http'; import Promise from 'bluebird'; @@ -13,21 +12,6 @@ import BindingAgent from './lib/BindingAgent'; 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'; // id -> client http server @@ -252,16 +236,6 @@ module.exports = function(opt) { 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) { res.json({ tunnels: stats.tunnels, diff --git a/yarn.lock b/yarn.lock index a71b587..1e7196c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -465,10 +465,6 @@ etag@~1.7.0: version "1.7.0" 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: version "4.14.0" 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" 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: version "0.11.0" 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" 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: version "1.5.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36"