Closed tanglong3bf closed 1 week ago
Will try to give it a review once I'm back home (╯°□°)╯︵ ┻━┻
P.S. the emoticon is just for fun
The reason this happens is
[](const drogon::HttpRequestPtr &req) -> bool {
if (!req->path().starts_with("/api") && req->path() != "/")
{
req->setPath("/");
return true;
}
return false;
}
Triggers right after the redirect logic populates protocol, host, and new path to GitHub.
Hence your check ends up overwriting the path to "/".
I'm unsure of the consequences of changing the orders, it may break other plugins in the process.
I'll do further tests and confirm. Or we could just add another handler to the pipeline and call it a day lol
For the above code, the expected goal is: access
localhost:8000
, redirect tohttps://github.com/drogonframework/drogon
. The old version of theRedirector
plugin redirects to thegithub.com
homepage, because the loop ofpathRewriteHandlers_
modifies thepath
. This is not as expected.