crow
crow copied to clipboard
How to redirect another url?
Hi guys, I'm trying to redirect logged out users to home page. I wrote the code below but it didn't work. Do you have any ideas about that?
CROW_ROUTE(app, "/logout")([](const crow::request &req, crow::response &res){
res.redirect("/");
});
hi, i have the same problem as well.
the redirect() method just sets the 301 http code and Location header so you need to pass the full URI with host like this res.redirect("http:
It worked for me
CROW_ROUTE(app, "/logout")([](const crow::request& req, crow::response& res)
{
res.redirect("/");
res.end();
});