CURLOPT_HAPROXYPROTOCOL(3)

CURLOPT_HAPROXYPROTOCOL3

Send haproxy proxy protocol v1 header

Usage

#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXYPROTOCOL,
                          long haproxy_protocol);

Overview

A long parameter set to 1 tells the library to send an HAProxy PROXY protocol v1 header at beginning of the connection. The default action is not to send this header.

This option is primarily useful when sending test requests to a service that expects this header.

Note that the HAProxy protocol message is only is sent over a freshly setup connection. A subsequent transfer that reuses a previous connection does not send it again.

Most applications do not need this option.

Default

0, do not send any HAProxy PROXY protocol header

Protocols

This functionality affects all supported protocols

Examples

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);
  }
}

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).

Releases

5 releases since Debian 10 (Buster); the text changed 4 times.

  1. 10
  2. 11
  3. 12
  4. 13
  5. Arch

Availability

Added in curl 7.60.0

From curl 8.23.0-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.