mirror of
https://github.com/opnsense/plugins.git
synced 2026-05-28 04:34:15 -04:00
net/haproxy: add support for the PROXY protocol
This commit is contained in:
parent
df6060f27b
commit
23dd301127
3 changed files with 20 additions and 0 deletions
|
|
@ -31,6 +31,13 @@
|
|||
<help><![CDATA[Define the load balancing algorithm to be used in a Backend Pool. See the <a target="_blank" href="http://cbonte.github.io/haproxy-dconv/1.8/configuration.html#balance">HAProxy documentation</a> for a full description.]]></help>
|
||||
<hint>Choose a load balancing algorithm.</hint>
|
||||
</field>
|
||||
<field>
|
||||
<id>backend.proxyProtocol</id>
|
||||
<label>Proxy Protocol</label>
|
||||
<type>dropdown</type>
|
||||
<help><![CDATA[Enforces use of the PROXY protocol over any connection established to the configured servers. The PROXY protocol informs the other end about the layer 3/4 addresses of the incoming connection, so that it can know the client's address or the public address it accessed to, whatever the upper layer protocol. This setting must not be used if the servers are not aware of the PROXY protocol. See the <a target="_blank" href="http://cbonte.github.io/haproxy-dconv/1.8/configuration.html#send-proxy">HAProxy documentation</a> for a full description.]]></help>
|
||||
<advanced>true</advanced>
|
||||
</field>
|
||||
<field>
|
||||
<id>backend.linkedServers</id>
|
||||
<label>Servers</label>
|
||||
|
|
|
|||
|
|
@ -620,6 +620,13 @@
|
|||
<uri>URI Hash (only HTTP mode)</uri>
|
||||
</OptionValues>
|
||||
</algorithm>
|
||||
<proxyProtocol type="OptionField">
|
||||
<Required>N</Required>
|
||||
<OptionValues>
|
||||
<v1>PROXY protocol version 1</v1>
|
||||
<v2>PROXY protocol version 2</v2>
|
||||
</OptionValues>
|
||||
</proxyProtocol>
|
||||
<linkedServers type="ModelRelationField">
|
||||
<Model>
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -1053,6 +1053,12 @@ backend {{backend.name}}
|
|||
{% elif server_data.source|default("") != "" %}
|
||||
{% do server_options.append('source ' ~ server_data.source) %}
|
||||
{% endif %}
|
||||
{# # PROXY protocol #}
|
||||
{% if backend.proxyProtocol|default("") == "v1" %}
|
||||
{% do server_options.append('send-proxy') %}
|
||||
{% elif backend.proxyProtocol|default("") == "v2" %}
|
||||
{% do server_options.append('send-proxy-v2') %}
|
||||
{% endif %}
|
||||
{# # server advanced options #}
|
||||
{% if server_data.advanced|default("") != "" %}
|
||||
{% do server_options.append(server_data.advanced) %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue