From 5fcff1f1a3c2789f6a14227a751b1d7a5b0dafe5 Mon Sep 17 00:00:00 2001 From: "jeremy@jermolene.com" Date: Sat, 10 Apr 2021 10:57:52 +0100 Subject: [PATCH] Refactor server route handling to handle default documents properly --- core/modules/server/routes/get-index.js | 2 +- core/modules/server/server.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/modules/server/routes/get-index.js b/core/modules/server/routes/get-index.js index c90341925..d4431ce64 100644 --- a/core/modules/server/routes/get-index.js +++ b/core/modules/server/routes/get-index.js @@ -16,7 +16,7 @@ var zlib = require("zlib"); exports.method = "GET"; -exports.path = /^\/$/; +exports.path = /^\/index.html$/; exports.handler = function(request,response,state) { var acceptEncoding = request.headers["accept-encoding"]; diff --git a/core/modules/server/server.js b/core/modules/server/server.js index eb95ee8a6..71e64d581 100644 --- a/core/modules/server/server.js +++ b/core/modules/server/server.js @@ -127,11 +127,11 @@ Server.prototype.addAuthenticator = function(AuthenticatorClass) { } }; -Server.prototype.findMatchingRoute = function(request,state) { +Server.prototype.findMatchingRoute = function(request,state,options) { + options = options || {}; for(var t=0; t