diff --git a/src/server.mjs b/src/server.mjs index 8bfbdc7..ae9b1cd 100644 --- a/src/server.mjs +++ b/src/server.mjs @@ -46,6 +46,7 @@ function getReqBody(req) { async function proxy(host, request, reqBody, response) { let pathname = url.parse(request.url).pathname; + pathname = pathname === "/" ? "" : pathname; // to avoid a trailing slash let hostname = url.parse(host).host; let proxyUrl = `${host}${pathname}`; let reqMethod = request.method;