updated haproxy state
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Paul 2022-12-26 18:13:39 +01:00
parent 262c03d359
commit b044e3adbf
2 changed files with 11 additions and 16 deletions

View File

@ -20,6 +20,7 @@ haproxy:
config: config:
dir: /etc/haproxy dir: /etc/haproxy
configfile: haproxy.cfg configfile: haproxy.cfg
namespace: paulbsd
servername: "High-performance Web Server" servername: "High-performance Web Server"
http2: true http2: true
defaults: defaults:

View File

@ -14,10 +14,6 @@
http-response return content-type text/html string "404 not found" if { status 404 } http-response return content-type text/html string "404 not found" if { status 404 }
{%- endmacro -%} {%- endmacro -%}
{%- macro serverheader() -%}
http-response set-header server "{{ haproxy.config.servername }}"
{%- endmacro -%}
{%- macro httpcheckrules(layer="layer7",inter="2s",fall=5,rise=5) -%}check observe {{ layer }} inter {{ inter }} fall {{ fall }} rise {{ rise }}{%- endmacro -%} {%- macro httpcheckrules(layer="layer7",inter="2s",fall=5,rise=5) -%}check observe {{ layer }} inter {{ inter }} fall {{ fall }} rise {{ rise }}{%- endmacro -%}
{%- macro httpsslrules() -%}ssl verify none{%- endmacro -%} {%- macro httpsslrules() -%}ssl verify none{%- endmacro -%}
@ -46,7 +42,7 @@
{%- macro admin() -%} {%- macro admin() -%}
# Stats Backend # Stats Backend
backend admin backend admin from {{ haproxy.config.namespace }}
mode http mode http
stats enable stats enable
stats admin if TRUE stats admin if TRUE
@ -82,7 +78,7 @@ global
ssl-dh-param-file {{ haproxy.config.acme_dh_dir }}/dh.pem ssl-dh-param-file {{ haproxy.config.acme_dh_dir }}/dh.pem
# Defaults values # Defaults values
defaults defaults {{ haproxy.config.namespace }}
{%- for key, value in haproxy.config.defaults.items() %} {%- for key, value in haproxy.config.defaults.items() %}
{{ key }} {{ value }} {{ key }} {{ value }}
{%- endfor %} {%- endfor %}
@ -94,11 +90,11 @@ cache static
max-age 120 max-age 120
# Per IP rates stick table # Per IP rates stick table
backend per_ip_rates backend per_ip_rates from {{ haproxy.config.namespace }}
stick-table type string size 1m expire {{ haproxy.config.ddos.timeperiod|default("10s") }} store http_req_rate({{ haproxy.config.ddos.timeperiod|default("10s")}}) stick-table type string size 1m expire {{ haproxy.config.ddos.timeperiod|default("10s") }} store http_req_rate({{ haproxy.config.ddos.timeperiod|default("10s")}})
# Default HTTP frontend # Default HTTP frontend
frontend http frontend http from {{ haproxy.config.namespace }}
bind *:{{ haproxy.config.http_port }},:::{{ haproxy.config.http_port }} v4v6 bind *:{{ haproxy.config.http_port }},:::{{ haproxy.config.http_port }} v4v6
mode http mode http
acl http ssl_fc,not acl http ssl_fc,not
@ -109,7 +105,7 @@ frontend http
http-request redirect scheme https if http http-request redirect scheme https if http
# Default HTTPS frontend # Default HTTPS frontend
frontend https frontend https from {{ haproxy.config.namespace }}
bind *:{{ haproxy.config.https_port }},:::{{ haproxy.config.https_port }} v4v6 ssl crt {{ haproxy.config.acme_fullchains_dir }}{% if haproxy.config.http2 %} alpn h2,http/1.1{% endif %} bind *:{{ haproxy.config.https_port }},:::{{ haproxy.config.https_port }} v4v6 ssl crt {{ haproxy.config.acme_fullchains_dir }}{% if haproxy.config.http2 %} alpn h2,http/1.1{% endif %}
#bind quic4@*:{{ haproxy.config.https_port }},quic6@:::{{ haproxy.config.https_port }} v4v6 ssl crt {{ haproxy.config.acme_fullchains_dir }}{% if haproxy.config.http2 %} alpn h2,http/1.1{% endif %} #bind quic4@*:{{ haproxy.config.https_port }},quic6@:::{{ haproxy.config.https_port }} v4v6 ssl crt {{ haproxy.config.acme_fullchains_dir }}{% if haproxy.config.http2 %} alpn h2,http/1.1{% endif %}
mode http mode http
@ -143,6 +139,8 @@ frontend https
http-request set-header X-Proto https if { ssl_fc } http-request set-header X-Proto https if { ssl_fc }
http-response set-header Date "%[date,http_date()]" http-response set-header Date "%[date,http_date()]"
http-response set-header Server "{{ haproxy.config.servername }}"
http-response set-header X-Random "%[rand,mul(5)]"
log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r" log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r"
http-request redirect location %[req.hdr(Host),map_dom({{ haproxy.config.dir }}/maps/redirects)] code 301 if { req.hdr(Host),map_dom({{ haproxy.config.dir }}/maps/redirects) -m found } http-request redirect location %[req.hdr(Host),map_dom({{ haproxy.config.dir }}/maps/redirects)] code 301 if { req.hdr(Host),map_dom({{ haproxy.config.dir }}/maps/redirects) -m found }
@ -157,7 +155,7 @@ frontend https
# HTTP Backends # HTTP Backends
{%- for name, values in haproxy.config.vhosts.items() %} {%- for name, values in haproxy.config.vhosts.items() %}
{%- if not values.redirect|default(False) %} {%- if not values.redirect|default(False) %}
backend {{ name }} backend {{ name }} from {{ haproxy.config.namespace }}
balance {{ values.balance|default(haproxy.config.balance) }} balance {{ values.balance|default(haproxy.config.balance) }}
mode http mode http
option forwardfor option forwardfor
@ -180,10 +178,6 @@ backend {{ name }}
{{ cache() }} {{ cache() }}
{%- endif %} {%- endif %}
{%- if values.serverheader|default(True) %}
{{ serverheader() }}
{%- endif %}
{%- if values.internal|default(False) %} {%- if values.internal|default(False) %}
{{ internal() }} {{ internal() }}
{%- endif %} {%- endif %}
@ -193,7 +187,7 @@ backend {{ name }}
# TCP services # TCP services
{%- for name, values in haproxy.config.services.items() %} {%- for name, values in haproxy.config.services.items() %}
listen {{ name }} listen {{ name }} from {{ haproxy.config.namespace }}
bind *:{{ values.port }},:::{{ values.port }} v4v6 bind *:{{ values.port }},:::{{ values.port }} v4v6
mode tcp mode tcp
option tcplog option tcplog
@ -207,7 +201,7 @@ listen {{ name }}
# SPOE Agents # SPOE Agents
{%- for name, values in haproxy.config.spoe.items() %} {%- for name, values in haproxy.config.spoe.items() %}
listen {{ name }} listen {{ name }} from {{ haproxy.config.namespace }}
bind *:{{ values.port }},:::{{ values.port }} v4v6 bind *:{{ values.port }},:::{{ values.port }} v4v6
{% endfor %} {% endfor %}