From 882c1d9ecd3526d8ef0bcb452a6ffef74e02e91c Mon Sep 17 00:00:00 2001 From: Tanglong3bf Date: Sat, 16 Nov 2024 15:04:57 +0800 Subject: [PATCH] fix a bug in plugin Redirector. (#2198) --- lib/src/Redirector.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/src/Redirector.cc b/lib/src/Redirector.cc index e3f53956..c7fa2745 100644 --- a/lib/src/Redirector.cc +++ b/lib/src/Redirector.cc @@ -30,6 +30,10 @@ void Redirector::initAndStart(const Json::Value &config) } std::string protocol, host; bool pathChanged{false}; + for (auto &handler : thisPtr->pathRewriteHandlers_) + { + pathChanged |= handler(req); + } for (auto &handler : thisPtr->handlers_) { if (!handler(req, protocol, host, pathChanged)) @@ -37,10 +41,6 @@ void Redirector::initAndStart(const Json::Value &config) return HttpResponse::newNotFoundResponse(req); } } - for (auto &handler : thisPtr->pathRewriteHandlers_) - { - pathChanged |= handler(req); - } if (!protocol.empty() || !host.empty() || pathChanged) { std::string url;