drogon icon indicating copy to clipboard operation
drogon copied to clipboard

forward cant works

Open GigaDevelopper opened this issue 1 year ago • 1 comments

I try forward to another side request but it doesnt work? Can everybody help me? FilterProxy.... std::string public_ip = result[0]["public_ip"].asstd::string();

    if(public_ip.empty())
        return fccb();

    // change protocol
    std::regex pattern("(ws|wss|http|https)://");
    public_ip = std::regex_replace(public_ip, pattern, "");
    public_ip.insert(0, "https://"/*req->isOnSecureConnection() ? "https://" : "http://"*/);
    req->attributes()->insert("public_ip", public_ip);

    // forward to other parking by public IP
    return drogon::app().forward(req, std::move(fcb), public_ip,10);
    //return fccb();
}

GigaDevelopper avatar May 04 '24 09:05 GigaDevelopper

Have you printed public_ip before the forward to check if it is forwarded to the right party?

One more thing to note, in the present time Drogon can't forward WebSockets, see this issue #2006

Another issue in case your URL contains spaces to be forwarded, is you have to manually reset the path to its original form before forwarding, see issue #2013

Mis1eader-dev avatar May 04 '24 09:05 Mis1eader-dev