From 163881163f6ab4ce302aede92c8291b7ac80cbab Mon Sep 17 00:00:00 2001 From: Seba Kerckhof Date: Wed, 26 Feb 2020 01:31:42 +0100 Subject: [PATCH] Don't lose the query string when using a path prefix (#10845) Fixes https://github.com/meteor/meteor/issues/10756 --- packages/webapp/package.js | 2 +- packages/webapp/webapp_server.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/webapp/package.js b/packages/webapp/package.js index 68af50c1db..726928310e 100644 --- a/packages/webapp/package.js +++ b/packages/webapp/package.js @@ -1,6 +1,6 @@ Package.describe({ summary: "Serves a Meteor app over HTTP", - version: '1.8.2' + version: '1.8.3' }); Npm.depends({"basic-auth-connect": "1.0.0", diff --git a/packages/webapp/webapp_server.js b/packages/webapp/webapp_server.js index 12ba0cf505..3665abab51 100644 --- a/packages/webapp/webapp_server.js +++ b/packages/webapp/webapp_server.js @@ -871,7 +871,7 @@ function runWebAppServer() { // Strip off the path prefix, if it exists. app.use(function (request, response, next) { const pathPrefix = __meteor_runtime_config__.ROOT_URL_PATH_PREFIX; - const { pathname } = parseUrl(request.url); + const { pathname, search } = parseUrl(request.url); // check if the path in the url starts with the path prefix if (pathPrefix) { @@ -879,6 +879,9 @@ function runWebAppServer() { const pathParts = getPathParts(pathname); if (isPrefixOf(prefixParts, pathParts)) { request.url = "/" + pathParts.slice(prefixParts.length).join("/"); + if (search) { + request.url += search; + } return next(); } }