Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forward cant works #2018

Open
GigaDevelopper opened this issue May 4, 2024 · 1 comment
Open

forward cant works #2018

GigaDevelopper opened this issue May 4, 2024 · 1 comment

Comments

@GigaDevelopper
Copy link

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();
}
@Mis1eader-dev
Copy link
Member

Mis1eader-dev commented May 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants