diff --git a/src/modules/http_async_client/doc/http_async_client_admin.xml b/src/modules/http_async_client/doc/http_async_client_admin.xml
index 1efe0a1f335..4e4701fcb3a 100644
--- a/src/modules/http_async_client/doc/http_async_client_admin.xml
+++ b/src/modules/http_async_client/doc/http_async_client_admin.xml
@@ -200,6 +200,26 @@ modparam("http_async_client", "curl_verbose", 1)
+
+ curl_follow_redirect (integer)
+
+ If defined to a non-zero value, will tell curl to follow HTTP 3xx redirects.
+
+
+
+ Default value is 0 (disabled).
+
+
+
+ Set curl_follow_redirect parameter
+
+...
+modparam("http_async_client", "curl_follow_redirect", 1)
+...
+
+
+
+
memory_manager (string)
diff --git a/src/modules/http_async_client/http_async_client_mod.c b/src/modules/http_async_client/http_async_client_mod.c
index 7f56f98a56d..f369cf083de 100644
--- a/src/modules/http_async_client/http_async_client_mod.c
+++ b/src/modules/http_async_client/http_async_client_mod.c
@@ -74,6 +74,7 @@ int tls_version = 0; // Use default SSL version in HTTPS requests (see curl/curl
int tls_verify_host = 1; // By default verify host in HTTPS requests
int tls_verify_peer = 1; // By default verify peer in HTTPS requests
int curl_verbose = 0;
+int curl_follow_redirect = 0;
char* tls_client_cert = NULL; // client SSL certificate path, defaults to NULL
char* tls_client_key = NULL; // client SSL certificate key path, defaults to NULL
char* tls_ca_path = NULL; // certificate authority dir path, defaults to NULL
@@ -150,6 +151,7 @@ static param_export_t params[]={
{"tls_verify_host", INT_PARAM, &tls_verify_host},
{"tls_verify_peer", INT_PARAM, &tls_verify_peer},
{"curl_verbose", INT_PARAM, &curl_verbose},
+ {"curl_follow_redirect", INT_PARAM, &curl_follow_redirect},
{"tls_client_cert", PARAM_STRING, &tls_client_cert},
{"tls_client_key", PARAM_STRING, &tls_client_key},
{"tls_ca_path", PARAM_STRING, &tls_ca_path},
diff --git a/src/modules/http_async_client/http_multi.c b/src/modules/http_async_client/http_multi.c
index c4351b1b94a..7baf1531401 100644
--- a/src/modules/http_async_client/http_multi.c
+++ b/src/modules/http_async_client/http_multi.c
@@ -462,6 +462,9 @@ int new_request(str *query, http_m_params_t *query_params, http_multi_cbe_t cb,
curl_easy_setopt(cell->easy, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(cell->easy, CURLOPT_DEBUGFUNCTION, debug_cb);
}
+ if (curl_follow_redirect) {
+ curl_easy_setopt(cell->easy, CURLOPT_FOLLOWLOCATION, 1L);
+ }
curl_easy_setopt(cell->easy, CURLOPT_ERRORBUFFER, cell->error);
curl_easy_setopt(cell->easy, CURLOPT_PRIVATE, cell);
curl_easy_setopt(cell->easy, CURLOPT_SSL_VERIFYPEER, cell->params.tls_verify_peer);
diff --git a/src/modules/http_async_client/http_multi.h b/src/modules/http_async_client/http_multi.h
index 0e63811df79..2a99b8cb361 100644
--- a/src/modules/http_async_client/http_multi.h
+++ b/src/modules/http_async_client/http_multi.h
@@ -58,6 +58,7 @@ extern stat_var *errors;
extern stat_var *timeouts;
extern int tls_version;
extern int curl_verbose;
+extern int curl_follow_redirect;
void set_curl_mem_callbacks(void);
int init_http_multi();