CURLOPT_HAPROXY_CLIENT_IP(3)
Welcome to the Library Functions Manual page for CURLOPT_HAPROXY_CLIENT_IP(3), bestie β we're about to make HAProxy PROXY protocol client IPs make sense. π
β¨ NAME β¨
CURLOPT_HAPROXY_CLIENT_IP β set HAProxy PROXY protocol client IP. periodt.
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXY_CLIENT_IP,
char *client_ip);
πΈ DESCRIPTION πΈ
okay so when this parameter is set to a valid IPv4 or IPv6 numerical address, the library sends this address as the client address in the HAProxy PROXY protocol v1 header at the beginning of the connection. slay.
This option is an alternative to CURLOPT_HAPROXYPROTOCOL(3) β because that one cannot use a specified address. iykyk.
Using this option multiple times makes the last set string override the previous ones. Set it to NULL to disable its use again. easy.
The application does not have to keep the string around after setting this option. π«Ά
β οΈ note, bestie: if you want to send a different HAProxy client IP in a subsequent request, you need to make sure that it is done over a fresh connection, as libcurl does not send it again while reusing connections.
π DEFAULT π
NULL, no HAProxy header is sent. that's the whole vibe.
π PROTOCOLS π
This functionality affects all supported protocols. all of them. π
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_HAPROXY_CLIENT_IP, "1.1.1.1");
result = curl_easy_perform(curl);
}
}
β AVAILABILITY β
Added in curl 8.2.0. vintage-ish but iconic.
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred β see libcurl-errors(3). no cap.
π§ SEE ALSO π§
π cute sign-off: source/version libcurl, dated 2026-10-12 β and yes, the footer's abbreviated title is CURLOPT_HA...Y_CLIENT_IP(3). stay curled, bestie! π«Άβ¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms