mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-02 03:38:03 +08:00
Move the RealIpResolver plugin to the PreRouting join point (#1904)
This commit is contained in:
parent
6b36b3a4f9
commit
d745cfe765
@ -106,7 +106,7 @@ void RealIpResolver::initAndStart(const Json::Value &config)
|
||||
trustCIDRs_.emplace_back(ipOrCidr);
|
||||
}
|
||||
|
||||
drogon::app().registerPreHandlingAdvice([this](const HttpRequestPtr &req) {
|
||||
drogon::app().registerPreRoutingAdvice([this](const HttpRequestPtr &req) {
|
||||
const std::string &ipHeader = req->getHeader(fromHeader_);
|
||||
const trantor::InetAddress &peerAddr = req->getPeerAddr();
|
||||
if (ipHeader.empty() || !matchCidr(peerAddr))
|
||||
|
Loading…
Reference in New Issue
Block a user