Ingress Controller not passing error status code to c# app #12766
Description
I have implemented a custom backend in my ingress controller which gets deployed via a helm chart through an azure devops pipeline. The idea is to enable backend to pass error status codes to c# app so it displays custom error page instead of ingress controller.
in my values.yml file of an existing working ingress controller in my dev environment I have made the following changes
# bypass nginx controllers for the chosen error codes
disable-proxy-intercept-errors: "true"
# Create a backend to handle the error codes
defaultBackend:
enabled: True
# use the recommended image for handling error codes.
# It will also deploy an additional pod per ingress controller per environment.
image:
image: ingress-nginx/custom-error-pages
Since the change a new pod has been added alongside my ingress controller.
our c# dev guys have written code to handle 413 and display a custom page
Problem: Custom error page written in c# app is not getting displayed. Instead a default ingress controller message appears when a large file is uploaded
Is there a way to confirm that the error is definitely being passed over to the c# app (which is deployed in aks cluster)
I see following in our ingress controller logs
10.142.0.92 - - [29/Jan/2025:16:41:07 +0000] "GET /DataSharing HTTP/2.0" 200 17821 "https://internal-portal.myorg.uk/ApplicationBulkUploads" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0" 3417 0.393 [internal-web-app-80] [] 10.142.0.206:5000 17841 0.392 200 131bd43195590e8xxxxxxxxxxx
and following in the default backend pod
2025/01/29 16:56:41 unexpected error reading media type extension: mime: unexpected content after media subtype. Using .htm
2025/01/29 16:56:41 unexpected error opening file: open /www/413.html: no such file or directory
2025/01/29 16:56:41 serving custom error response for code 413 and format text/html from file /www/4xx.html
2025/01/29 16:58:31 unexpected error reading media type extension: mime: unexpected content after media subtype. Using .htm
2025/01/29 16:58:31 unexpected error opening file: open /www/413.html: no such file or directory
2025/01/29 16:58:31 serving custom error response for code 413 and format text/html from file /www/4xx.html
2025/01/29 17:04:50 unexpected error reading media type extension: mime: unexpected content after media subtype. Using .htm
2025/01/29 17:04:50 unexpected error opening file: open /www/413.html: no such file or directory
you can see that the day is same but the time is not, so im not sure what to make of above information so looks like logs in the default backend pod are not related to the error logged in the ingress controller
error in my ingress controller log was generated by trying to upload a large file
Our helm chart version is 4.0.5
and NGINX Ingress controller version is as below
Release: v1.0.3
Repository: https://github.com/kubernetes/ingress-nginx
nginx version: nginx/1.19.9
Metadata
Assignees
Labels
Type
Projects
Status
No status