haproxytech / helm-charts

Helm chart for HAProxy Kubernetes Ingress Controller
Apache License 2.0
155 stars 121 forks source link

Not able to set custom error pages on the response of 404 and 503 ! Tried Configmaps and Values.yaml ! #249

Closed abhi-gaur closed 3 months ago

abhi-gaur commented 4 months ago

-------Configmaps----------

apiVersion: v1 kind: ConfigMap metadata: name: custom-error-pages namespace: haproxy-controller data: 404.html: | <!DOCTYPE html>

404 Not Found nhi pta kaha h

503.html: | <!DOCTYPE html>

503 Service Unavailable Custom 503 Service Unavailable page

----------Values.yaml -------------

controller: ingressClassResource: enabled: true stats: enabled: true metrics: enabled: true serviceMonitor: enabled: true labels: release: kube-prometheus-stack metrics: relabelings:

--------second values.yaml --------

controller: ingressClassResource: enabled: true stats: enabled: true metrics: enabled: true serviceMonitor: enabled: true labels: release: kube-prometheus-stack metrics: relabelings:

dkorunic commented 4 months ago

Hi @abhi-gaur, here are the steps to make it work:

  1. create a ConfigMap object containing errorfile (for instance haproxy-controller/errorfile), as documented here.

  2. add --configmap-errorfiles=haproxy-controller/errorfile parameter referencing errorfile and its namespace to extraArgs in your Helm Chart values override.

dkorunic commented 4 months ago

Also note, it's not data: 404.html: ..., it is data: 404: ..., where number maps to HTTP Status Code.