瀏覽代碼

Add X-Forwarded-For as well

master
Chris Smith 5 年之前
父節點
當前提交
d51a7521ff
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      templates/haproxy.cfg.tpl

+ 2
- 1
templates/haproxy.cfg.tpl 查看文件

@@ -21,9 +21,10 @@ frontend main
21 21
     mode    http
22 22
     bind    :443 ssl strict-sni alpn h2,http/1.1 crt /certs/
23 23
     bind    :80
24
+    http-request set-header X-Forwarded-For %[src]
25
+    http-request set-header X-Forwarded-Proto https if { ssl_fc }
24 26
     redirect scheme https code 301 if !{ ssl_fc }
25 27
     http-response set-header Strict-Transport-Security max-age=15768000
26
-    http-request set-header X-Forwarded-Proto https if { ssl_fc }
27 28
 {{- range .Hostnames }}
28 29
     use_backend {{ .Name | replace "." "_" }} if { hdr(host) -i {{ .Name }}
29 30
         {{- range $san, $_ := .Alternatives }} || hdr(host) -i {{ $san }} {{- end }} }

Loading…
取消
儲存