diff --git a/include/crow/http_connection.h b/include/crow/http_connection.h index 3757c52ba..1246fda8a 100644 --- a/include/crow/http_connection.h +++ b/include/crow/http_connection.h @@ -258,18 +258,6 @@ namespace crow } } #endif - //if there is a redirection with a partial URL, treat the URL as a route. - std::string location = res.get_header_value("Location"); - if (!location.empty() && location.find("://", 0) == std::string::npos) - { -#ifdef CROW_ENABLE_SSL - if (handler_->ssl_used()) - location.insert(0, "https://" + req_.get_header_value("Host")); - else -#endif - location.insert(0, "http://" + req_.get_header_value("Host")); - res.set_header("location", location); - } prepare_buffers(); diff --git a/include/crow/routing.h b/include/crow/routing.h index e19561332..279753060 100644 --- a/include/crow/routing.h +++ b/include/crow/routing.h @@ -1462,16 +1462,7 @@ namespace crow // NOTE: Already documented in "crow/app.h" { CROW_LOG_INFO << "Redirecting to a url with trailing slash: " << req.url; res = response(301); - - // TODO(ipkn) absolute url building - if (req.get_header_value("Host").empty()) - { - res.add_header("Location", req.url + "/"); - } - else - { - res.add_header("Location", (using_ssl ? "https://" : "http://") + req.get_header_value("Host") + req.url + "/"); - } + res.add_header("Location", req.url + "/"); res.end(); return; } @@ -1710,16 +1701,7 @@ namespace crow // NOTE: Already documented in "crow/app.h" { CROW_LOG_INFO << "Redirecting to a url with trailing slash: " << req.url; res = response(301); - - // TODO(ipkn) absolute url building - if (req.get_header_value("Host").empty()) - { - res.add_header("Location", req.url + "/"); - } - else - { - res.add_header("Location", (using_ssl ? "https://" : "http://") + req.get_header_value("Host") + req.url + "/"); - } + res.add_header("Location", req.url + "/"); res.end(); return; }