我有以下HAProxy的配置:HAProxy的錯誤文件無法讀取
frontend http-in
mode http
bind :80
option forwardfor
option httplog
reqadd X-Forwarded-Proto:\ http
default_backend http-routers
errorfile 502 /var/haproxy/404.http
acl is_internal_error status eq 404
rspdeny . if is_internal_error
當我打的網址不存在的域名,例如:http://test.example.com 我收到超時錯誤(408)。
但是,當我檢索行errorfile 502 /var/haproxy/404.http
時,可以看到502錯誤代碼的默認錯誤信息。
誰能說出爲什麼Haproxy無法讀取我的文件/var/haproxy/404.http
?
haproxy作爲根運行。我將/var/haproxy/404.http的權限更改爲777(chmod 777)。但它仍然是同樣的問題 –
看起來根本原因是AWS ELB。其實,我有HAproxy是在AWS ELB後面。只要我刪除ELB,我可以得到自定義錯誤頁面。但是,在Haproxy前端的ELB中,我得到'HTTP/1.1 504 GATEWAY_TIMEOUT Content-Length:0 Connection:keep-alive'。任何人都可以告訴我發生了什麼事。謝謝。 –
它解決了這個問題http://stackoverflow.com/questions/43376997/haproxy-behind-elb –