NGINX Ingress controller version: 1.10.0

👍 kubectl version
Client Version: v1.29.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.7-eks-b9c9ed7

Environment :

GKE , EKS , AKS
OS : Alpine Linux
What happened:

I wanted to have custom error_page for specific error code. I am using https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/custom-errors to setup . 
I have passed the default-backend-service flag in ingress controller deployment too . 

`--default-backend-service=$(POD_NAMESPACE)/default-http-backend`

 I am getting below error and the custom-error doesn't work .  The redirection is not working too . Could you please help here ?


`│ 2024/05/17 14:43:18 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:43:18 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:43:18 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:45:50 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:45:50 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:45:50 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:51:13 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:51:13 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:51:13 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:52:03 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:52:03 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:52:03 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:52:04 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:52:04 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:52:04 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:54:21 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:54:21 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:54:21 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:55:19 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:55:19 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:55:19 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 15:09:58 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 15:09:58 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 15:09:58 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 15:14:25 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 15:14:25 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 15:14:25 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 15:20:40 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 15:20:40 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 15:20:40 serving custom error response for code 404 and format text/html from file /www/404.html `

What you expected to happen:
404 and 302  redirection should  work

How to reproduce it (as minimally and precisely as possible):
Use the mention step in https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/custom-errors  
Custom-error page is not working 
This is a GitHub Issue
repo:ingress-nginx
owner:kubernetes
Title : Custom-error page is not working 
Issue date:

--- start body ---
NGINX Ingress controller version: 1.10.0

👍 kubectl version
Client Version: v1.29.1
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.7-eks-b9c9ed7

Environment :

GKE , EKS , AKS
OS : Alpine Linux
What happened:

I wanted to have custom error_page for specific error code. I am using https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/custom-errors to setup . 
I have passed the default-backend-service flag in ingress controller deployment too . 

`--default-backend-service=$(POD_NAMESPACE)/default-http-backend`

 I am getting below error and the custom-error doesn't work .  The redirection is not working too . Could you please help here ?


`│ 2024/05/17 14:43:18 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:43:18 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:43:18 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:45:50 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:45:50 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:45:50 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:51:13 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:51:13 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:51:13 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:52:03 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:52:03 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:52:03 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:52:04 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:52:04 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:52:04 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:54:21 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:54:21 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:54:21 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 14:55:19 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 14:55:19 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 14:55:19 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 15:09:58 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 15:09:58 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 15:09:58 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 15:14:25 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 15:14:25 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 15:14:25 serving custom error response for code 404 and format text/html from file /www/404.html                                                                              │
│ 2024/05/17 15:20:40 format not specified. Using text/html                                                                                                                                │
│ 2024/05/17 15:20:40 unexpected error reading return code: strconv.Atoi: parsing "": invalid syntax. Using 404                                                                            │
│ 2024/05/17 15:20:40 serving custom error response for code 404 and format text/html from file /www/404.html `

What you expected to happen:
404 and 302  redirection should  work

How to reproduce it (as minimally and precisely as possible):
Use the mention step in https://github.com/kubernetes/ingress-nginx/tree/main/docs/examples/customization/custom-errors  
--- end body ---
