CURLOPT_HAPROXYPROTOCOL(3)
π CURLOPT_HAPROXYPROTOCOL π
okay so bestie, you're in the Library Functions Manual section of the curl man pages (yes, that's the manual name, we're being β¨officialβ¨ today) and this one is about CURLOPT_HAPROXYPROTOCOL β the little option that makes your connection start with a vibe check for HAProxy. let's get into it π
β¨ NAME β¨
CURLOPT_HAPROXYPROTOCOL β send HAProxy PROXY protocol v1 header π«Ά
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXYPROTOCOL,
long haproxy_protocol);
β¨ DESCRIPTION β¨
so here's the tea β β you pass a long parameter set to 1, and that tells the library to send an HAProxy PROXY protocol v1 header right at the beginning of the connection. iconic. and the default action? not sending this header. no header, no drama π
this option is primarily useful when you're sending test requests to a service that expects this header β like, that service is standing there with its hand out waiting for it, so you gotta deliver π
most applications do not need this option. fr fr, this is a niche little icon and that's okay π
β¨ DEFAULT β¨
0, do not send any HAProxy PROXY protocol header β just pure, headerless energy πΈ
β¨ PROTOCOLS β¨
this functionality affects all supported protocols. all of them. every single one. we love an inclusive queen π
β¨ 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_HAPROXYPROTOCOL, 1L);
result = curl_easy_perform(curl);
}
}
look at her go π setting the URL, setting CURLOPT_HAPROXYPROTOCOL to 1L, and performing. main character energy honestly π₯
β¨ AVAILABILITY β¨
added in curl 7.60.0 β a classic, a legend, a pioneer β
β¨ RETURN VALUE β¨
curl_easy_setopt(3) returns a CURLcode indicating success or error π
CURLE_OK (0) means everything was OK β slay β
and non-zero means an error occurred π if that happens, go see libcurl-errors(3) for the whole breakdown.
β¨ SEE ALSO β¨
and that's the whole page bestie, no cap π§
mwah π β brought to you by the libcurl girlies, dated 2026-10-12, and this has been CURLOPT_HAPROXYPROTOCOL(3). iykyk π¦
π¦ 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