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:
26
server.js
26
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,
|
||||
|
||||
Reference in New Issue
Block a user