forward cookie header

This commit is contained in:
Jeff Raymakers
2025-03-27 13:22:45 -07:00
parent 788dc4ea50
commit 07ed1ea806

View File

@@ -251,8 +251,14 @@ void HttpServer::HandleGet(const httplib::Request &req,
client.enable_server_certificate_verification(false); client.enable_server_certificate_verification(false);
} }
httplib::Headers headers = {{"User-Agent", user_agent}};
auto cookie = req.get_header_value("Cookie");
if (!cookie.empty()) {
headers.emplace("Cookie", cookie);
}
// forward GET to remote URL // forward GET to remote URL
auto result = client.Get(req.path, req.params, {{"User-Agent", user_agent}}); auto result = client.Get(req.path, req.params, headers);
if (!result) { if (!result) {
res.status = 500; res.status = 500;
res.set_content("Could not fetch: '" + req.path + "' from '" + remote_url + res.set_content("Could not fetch: '" + req.path + "' from '" + remote_url +