From 269f57d825945501f25a4a0da7e2d6f3fe6fb6d0 Mon Sep 17 00:00:00 2001 From: DavidWells Date: Tue, 31 Jul 2018 16:37:21 -0700 Subject: [PATCH] add support for http-server --- lib/serve.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/serve.js b/lib/serve.js index 46374e36..95b1d969 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -45,7 +45,10 @@ function promiseCallback(promise, callback) { function createHandler(dir) { return function(request, response) { - var func = request.path.split("/").filter(function(e) { + // handle proxies without path re-writes (http-servr) + var cleanPath = request.path.replace(/^\/.netlify\/functions/, '') + + var func = cleanPath.split("/").filter(function(e) { return e; })[0]; var module = path.join(process.cwd(), dir, func);