fix a bug in plugin Redirector. (#2198)

This commit is contained in:
Tanglong3bf 2024-11-16 15:04:57 +08:00 committed by GitHub
parent 8541e67143
commit 882c1d9ecd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -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;