1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_HAPROXY_CLIENT_IP
5Section: 3
6Source: libcurl
7Protocol:
8  - All
9See-also:
10  - CURLOPT_HAPROXYPROTOCOL (3)
11  - CURLOPT_PROXY (3)
12---
13
14# NAME
15
16CURLOPT_HAPROXY_CLIENT_IP - set HAProxy PROXY protocol client IP
17
18# SYNOPSIS
19
20~~~c
21#include <curl/curl.h>
22
23CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HAPROXY_CLIENT_IP,
24                          char *client_ip);
25~~~
26
27# DESCRIPTION
28
29When this parameter is set to a valid IPv4 or IPv6 numerical address, the
30library sends this address as client address in the HAProxy PROXY protocol v1
31header at beginning of the connection.
32
33This option is an alternative to CURLOPT_HAPROXYPROTOCOL(3) as that one
34cannot use a specified address.
35
36# DEFAULT
37
38NULL, no HAProxy header is sent
39
40# EXAMPLE
41
42~~~c
43int main(void)
44{
45  CURL *curl = curl_easy_init();
46  if(curl) {
47    CURLcode ret;
48    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
49    curl_easy_setopt(curl, CURLOPT_HAPROXY_CLIENT_IP, "1.1.1.1");
50    ret = curl_easy_perform(curl);
51  }
52}
53~~~
54
55# AVAILABILITY
56
57Along with HTTP. Added in 8.2.0.
58
59# RETURN VALUE
60
61Returns CURLE_OK if HTTP is enabled, and CURLE_UNKNOWN_OPTION if not.
62