fix finalhandler for 404s
This commit is contained in:
parent
fdcf205b49
commit
73f26d6e05
|
@ -5,7 +5,7 @@
|
|||
var pkg = require('../package.json');
|
||||
|
||||
var argv = process.argv.slice(2);
|
||||
var telebitd = require('../');
|
||||
var relay = require('../');
|
||||
var Greenlock = require('greenlock');
|
||||
|
||||
var confIndex = argv.indexOf('--config');
|
||||
|
@ -168,7 +168,7 @@ function applyConfig(config) {
|
|||
};
|
||||
|
||||
var net = require('net');
|
||||
var netConnHandlers = telebitd.create(state); // { tcp, ws }
|
||||
var netConnHandlers = relay.create(state); // { tcp, ws }
|
||||
var WebSocketServer = require('ws').Server;
|
||||
var wss = new WebSocketServer({ server: (state.httpTunnelServer || state.httpServer) });
|
||||
wss.on('connection', netConnHandlers.ws);
|
||||
|
|
|
@ -114,13 +114,11 @@ module.exports.create = function (state) {
|
|||
//
|
||||
// To ADMIN / CONTROL PANEL of the Tunnel Server Itself
|
||||
//
|
||||
var serveAdmin = require('serve-static')(__dirname + '/admin', { redirect: true });
|
||||
var serveAdmin = require('serve-static')(__dirname + '/../admin', { redirect: true });
|
||||
var finalhandler = require('finalhandler');
|
||||
state.httpTunnelServer = http.createServer(function (req, res) {
|
||||
res.setHeader('connection', 'close');
|
||||
serveAdmin(req, res, function () {
|
||||
finalhandler(req, res)
|
||||
});
|
||||
serveAdmin(req, res, finalhandler(req, res));
|
||||
});
|
||||
Object.keys(state.tlsOptions).forEach(function (key) {
|
||||
tunnelAdminTlsOpts[key] = state.tlsOptions[key];
|
||||
|
@ -152,7 +150,7 @@ module.exports.create = function (state) {
|
|||
//
|
||||
// First time setup
|
||||
//
|
||||
var serveSetup = require('serve-static')(__dirname + '/admin/setup', { redirect: true });
|
||||
var serveSetup = require('serve-static')(__dirname + '/../admin/setup', { redirect: true });
|
||||
var finalhandler = require('finalhandler');
|
||||
state.httpSetupServer = http.createServer(function (req, res) {
|
||||
if (req.socket.encrypted) {
|
||||
|
|
Loading…
Reference in New Issue