[英]How make haproxy read scss/images/icons files inside assets folder referenced in a index.htm file?
如何使 haproxy k8s pod 讀取 index.htm 文件中引用的資產文件夾內的 scss/images/icons 文件?
我有一個維護頁面,其文本信息完美無缺。 當我們的后端應用程序由於某種原因關閉並且我們收到 503 錯誤消息時,我們使用維護頁面。
下面是 haproxy.cfg 文件
global
log 127.0.0.1 local1
maxconn 4096
ssl-default-bind-ciphers TLS13-AES-256-GCM-SHA384:TLS13-AES-128-GCM-SHA256:TLS13-CHACHA20-POLY1305-SHA256:EECDH+AESGCM:EECDH+CHACHA20
ssl-default-bind-options no-sslv3 no-tlsv10 no-tlsv11
defaults
mode http
maxconn 2048
frontend e-store-app
bind *:80
bind *:443 ssl crt /usr/local/etc/haproxy/e-store-app.pem
errorfile 503 /usr/local/etc/haproxy/errors/index.html
# 16000000 seconds is a bit more than 6 months
http-response set-header Strict-Transport-Security "max-age=16000000; includeSubDomains; preload;"
redirect scheme https if !{ ssl_fc }
mode http
timeout connect 5s
timeout client 5s
timeout server 5s
default_backend e-store-app
backend e-store-app
redirect scheme https if !{ ssl_fc }
server e-store-app e-store-app:8080 check inter 5s rise 2 fall 3
compression algo gzip
compression type text/css text/html text/javascript application/javascript text/plain text/xml application/json
Haproxy 部署。
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-haproxy
spec:
replicas: 1
selector:
matchLabels:
app: test-haproxy
template:
metadata:
labels:
app: test-haproxy
spec:
containers:
- name: test-haproxy
image: haproxy:1.7
imagePullPolicy: Always
ports:
- containerPort: 80
- containerPort: 443
volumeMounts:
- mountPath: "/usr/local/etc/haproxy"
name: haproxy-config
volumes:
- name: haproxy-config
hostPath:
path: /root/kubernetes/dev-cluster-manifest/haproxy
index.html 中的文本消息按預期出現,但不是 errors/assests 目錄內的 index.html 文件中引用的 scss/images。
我們在 haproxy 配置文件中做錯了嗎? 如何讓 haproxy 讀取圖像、圖標,在 errors/assest 目錄中可用並在 index.html 文件中引用。
由於 HAProxy 是反向代理而不是網絡服務器,因此您不能通過 HAProxy 從光盤讀取資產。
您可以做的是將資產中的所有數據添加到 html 文件中,這可能需要增加tune.bufsize 。
請考慮使用受支持的 HAProxy 版本,如 2.6 或 2.7,因為部署顯示image: haproxy:1.7
,社區不再支持該版本,請參閱https://www.haproxy.org/上的表格
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.