diff --git a/src/RestClient.cc b/src/RestClient.cc index fd73a987..85df36aa 100644 --- a/src/RestClient.cc +++ b/src/RestClient.cc @@ -286,6 +286,12 @@ RestResponse Rest::Request(HttpMethod _method, // Set the default value: do not prove that SSL certificate is authentic curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + // Follow redirects to any URL set on the Location header. + curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); + + // Set cURL to only follow 3 redirects tops. + curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L); + std::ifstream ifs; struct curl_httppost *formpost = nullptr;