Created attachment 1822771 [details] yaml file to create custom 404 and 503 pages Description of problem: When importing a custom HTTP 404, 503 response from file the ingress controller configured to use the custom map fails to start. OpenShift release version: 4.9.0-0.nightly-2021-09-10-170926 Cluster Platform: N/A How reproducible: 100% Steps to Reproduce (in detail): Using the following build of docs; https://deploy-preview-36065--osdocs.netlify.app/openshift-enterprise/latest/networking/ingress-operator?utm_source=github&utm_campaign=bot_dp#nw-customize-ingress-error-pages_configuring-ingress 1. Create error-page-503.http and file=error-page-404.http cat << EOF > error-page-404.http "HTTP/1.0 404 Not Found\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n<html>\r\n<head><title>Not Found</title></head>\r\n<body>\r\n<p>Custom error page:The requested document was not found.</p>\r\n</body>\r\n</html>\r\n" EOF cat << EOF > error-page-503.http "HTTP/1.0 503 Service Unavailable\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n<html>\r\n<head><title>Application Unavailable</title></head>\r\n<body>\r\n<p>Custom error page:The requested application is not available.</p>\r\n</body>\r\n</html>\r\n" EOF 2. Create CM oc -n openshift-config create configmap my-custom-error-code-pages --from-file=error-page-503.http --from-file=error-page-404.http 3. Patch ingresscontrollers/default oc -n openshift-ingress-operator patch ingresscontrollers/default --type=merge --patch='{"spec":{"httpErrorCodePages":{"name":"my-custom-error-code-pages"}}}' 4. Delete default errorpages CM oc delete cm default-errorpages -n openshift-ingress Actual results: Router pods fail to start, show haproxy errors: [ALERT] 255/124104 (23) : parsing [/var/lib/haproxy/conf/haproxy.config:43] : errorfile : '/var/lib/haproxy/conf/error_code_pages/error-page-503.http': unabled to parse headers (error offset: 0) [ALERT] 255/124104 (23) : parsing [/var/lib/haproxy/conf/haproxy.config:44] : errorfile : '/var/lib/haproxy/conf/error_code_pages/error-page-404.http': unabled to parse headers (error offset: 0) [ALERT] 255/124104 (23) : Error(s) found in configuration file : /var/lib/haproxy/conf/haproxy.config [ALERT] 255/124104 (23) : Fatal errors found in configuration. Expected results: Router pods to start and custom error pages to display. Impact of the problem: All applications served by respective ingress are offline. Additional info: When creating the pages using a yaml import (attached), the customized pages work as expected. ** Please do not disregard the report template; filling the template out as much as possible will allow us to help you. Please consider attaching a must-gather archive (via `oc adm must-gather`). Please review must-gather contents for sensitive information before attaching any must-gathers to a bugzilla report. You may also mark the bug private if you wish.
I am not sure
Please ignore my previous comment
Putting an http response in inverted quotes is wrong "HTTP/1.0 404 Not Found\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n<html>\r\n<head><title>Not Found</title></head>\r\n<body>\r\n<p>Custom error page:The requested document was not found.</p>\r\n</body>\r\n</html>\r\n" A http repsonse looks like this -> https://raw.githubusercontent.com/openshift/router/master/images/router/haproxy/conf/error-page-503.http ---we ship by default https://raw.githubusercontent.com/Jonathan-Rosewood/haproxy-custom-errors/master/503.http --- a custom one Where is it mentioned to do this ? I don't see this thing mentioned anywhere cat << EOF > error-page-404.http "HTTP/1.0 404 Not Found\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n<html>\r\n<head><title>Not Found</title></head>\r\n<body>\r\n<p>Custom error page:The requested document was not found.</p>\r\n</body>\r\n</html>\r\n" EOF cat << EOF > error-page-503.http "HTTP/1.0 503 Service Unavailable\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n<html>\r\n<head><title>Application Unavailable</title></head>\r\n<body>\r\n<p>Custom error page:The requested application is not available.</p>\r\n</body>\r\n</html>\r\n" EOF
Also as per the doc it should not be HttpErrorCodePages but httpErrorCodePages $ oc patch -n openshift-ingress-operator ingresscontroller/default --patch '{"spec":{"httpErrorCodePages": "my-custom-error-code-pages"}}' --type=merge The docs team is still working on this doc so it is work in progress.
What should the contents of error-page-404.http and error-page-503.http be for the most fundamental, working example? @misalunk
I am not able to reproduce this bug, I tried deleting configmap "my-custom-error-code-pages" from openshift-config namespace first, then I re-created the configmap. I also tried just delete configmap "default-errorpages" from openshift-ingress namespace. In both cases, haproxy router was restarted and health check was ok. Please see attachment "reproduction of bug 2003696"
my error page files: [jechen@jechen ~]$ cat ./NE-379-test/error-page-503.http HTTP/1.0 503 Service Unavailable Connection: close Content-Type: text/html <html> <head><title>Custom:Application Unavailable</title></head> <body> <p>Custom error page:The requested application is not available.</p> </body> </html> [jechen@jechen ~]$ cat ./NE-379-test/error-page-404.http HTTP/1.0 404 Not Found Connection: close Content-Type: text/html <html> <head><title>Custom:Not Found</title></head> <body> <p>Custom error page:The requested document was not found.</p> </body> </html>
The input in comment 0 is invalid because it uses literal double-quotes and "\r\n" strings. Bug 2003961 covers the documentation side of things (the documentation seems clear to me, but maybe we could be a little more explicit that the user needs to include HTTP response headers). Closing as NOTABUG.