Просмотр исходного кода

sni-router: collapse haproxy bind to comma-separated form

Switch to one-line `bind :80,[::]:80` and `bind :443,[::]:443` per
review feedback in #522.  The v6only flag was self-documentation, not
load-bearing: with SO_REUSEADDR (HAProxy's default) and bindv6only=0
the kernel routes v4 packets to the more-specific AF_INET socket
regardless.  Comment trimmed to match — the v6only paragraph is gone
because v6only itself is gone.

The shorter form also scales more cleanly when adding ports later,
e.g. `bind :8080,[::]:8080` on a new line.
pull/522/head
Alexey Dolotov 1 неделю назад
Родитель
Сommit
a7febc2bf2
1 измененных файлов: 4 добавлений и 8 удалений
  1. 4
    8
      contrib/sni-router/haproxy.cfg

+ 4
- 8
contrib/sni-router/haproxy.cfg Просмотреть файл

@@ -23,12 +23,9 @@ defaults
23 23
 # --- HTTP :80 — ACME challenges + redirect -----------------------------------
24 24
 
25 25
 frontend http
26
-    # Explicit v4 + v6 binds so IPv6 clients are accepted regardless of the
27
-    # host's net.ipv6.bindv6only sysctl.  `v6only` on the v6 bind prevents it
28
-    # from also accepting v4-mapped connections, which would otherwise
29
-    # conflict with the explicit v4 bind on the same port.
30
-    bind 0.0.0.0:80
31
-    bind [::]:80 v6only
26
+    # Explicit v4 + v6 binds so IPv6 clients are accepted regardless of
27
+    # the host's net.ipv6.bindv6only sysctl.
28
+    bind :80,[::]:80
32 29
     mode http
33 30
 
34 31
     # Let Caddy answer ACME HTTP-01 challenges for Let's Encrypt.
@@ -40,8 +37,7 @@ frontend http
40 37
 # --- TLS :443 — SNI-based routing -------------------------------------------
41 38
 
42 39
 frontend tls
43
-    bind 0.0.0.0:443
44
-    bind [::]:443 v6only
40
+    bind :443,[::]:443
45 41
     tcp-request inspect-delay 5s
46 42
     tcp-request content accept if { req_ssl_hello_type 1 }
47 43
 

Загрузка…
Отмена
Сохранить