Nginx custom error page unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404

18 views Asked by At

We configured nginx-ingress controller configmap and values yaml with the help of this documentation. https://kubernetes.github.io/ingress-nginx/examples/customization/custom-errors/#customized-default-backend

this is our configmap.yaml;

` # Custom error page configMap apiVersion: v1 kind: ConfigMap metadata: name: custom-error-pages namespace: ingress-nginx data: 404: | PAGE NOT FOUND PAGE NOT FOUND 503: | CUSTOM SERVICE UNAVAILABLE CUSTOM SERVICE UNAVAILABLE 400: | BAD REQUEST BAD REQUEST this is the defaultbackend block at values.yml

defaultBackend:
  enabled: true
  image:
    registry: registry.adress.com
    image: ingress-nginx/nginx-errors
    tag: "v20230505@sha256:3600dcd1bbd0d05959bb01af4b272714e94d22d24a64e91838e7183c80e53f7f"
  extraVolumes:
  - name: custom-error-pages
    configMap:
      name: custom-error-pages
      items:
      - key: "404"
        path: "404.html"
      - key: "503"
        path: "503.html"
      - key: "400"
        path: "400.html"
  extraVolumeMounts:
  - name: custom-err`

This configuration works for 404 and 503 as expected but for bad requests (400) we are having nginx default 500 internal server error page somehow;

http://api-safdslimitrevisor.apps.dev.domain.com.tr/%2e%2e//google.com

We have such error logs at pod level;

2024/03/13 14:21:58 format not specified. Using text/html 2024/03/13 14:21:58 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:58 format not specified. Using text/html 2024/03/13 14:21:58 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404 2024/03/13 14:21:58 serving custom error response for code 404 and format text/html from file /www/404.html 2024/03/13 14:21:58 format not specified. Using text/html 2024/03/13 14:21:58 serving custom error response for code 404 and format text/html from file /www/404.html 2024/03/13 14:21:58 format not specified. Using text/html 2024/03/13 14:21:58 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:58 format not specified. Using text/html 2024/03/13 14:21:58 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:58 format not specified. Using text/html 2024/03/13 14:21:58 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:58 format not specified. Using text/html 2024/03/13 14:21:58 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:59 format not specified. Using text/html 2024/03/13 14:21:59 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:59 format not specified. Using text/html 2024/03/13 14:21:59 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:59 format not specified. Using text/html 2024/03/13 14:21:59 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:21:59 format not specified. Using text/html 2024/03/13 14:21:59 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:22:00 format not specified. Using text/html 2024/03/13 14:22:00 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:22:00 format not specified. Using text/html 2024/03/13 14:22:00 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:22:00 format not specified. Using text/html 2024/03/13 14:22:00 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:22:00 format not specified. Using text/html 2024/03/13 14:22:00 serving custom error response for code 400 and format text/html from file /www/400.html 2024/03/13 14:22:01 format not specified. Using text/html 2024/03/13 14:22:01 serving custom error response for code 400 and format text/html from file /www/400.html

http://api-safdslimitrevisor.apps.dev.domain.com.tr/%2e%2e//google.com

http://api-safdslimitrevisor.apps.dev.domain.com.tr/%2e%2e//google.com We expect to have BAD REQUEST

But having; 500 Internal Server Error

0

There are 0 answers