How to make haproxy k8s pod read scss/images/icons files inside assets folder referenced in a index.htm file?
I have a maintenance page whose text info is coming perfectly. We used maintenance page when our backend application is down for reason and we get 503 error message.
Below is the haproxy.cfg file
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 Deployment.
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
Text message in the index.html is coming as expected but not the scss/images referenced in the index.html file inside the errors/assests directory.
Is something wrong we are doing in the haproxy config file? how to make haproxy read images,icons, available inside errors/assest directory and referenced inside index.html file.