-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return real http error code instead of 200 #2620
Conversation
custom http error pages should return real error code instead of 200
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: chestack Assign the PR to them by writing The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@aledbf , please help review |
Codecov Report
@@ Coverage Diff @@
## master #2620 +/- ##
=======================================
Coverage 40.68% 40.68%
=======================================
Files 75 75
Lines 5108 5108
=======================================
Hits 2078 2078
Misses 2751 2751
Partials 279 279 Continue to review full report at Codecov.
|
This feature assumes your backend returns the expected error code. Eg. your "error backend" should return the HTTP code 500 when servicing a /500.html page. Could you provide more information about your setup? I suppose you have a web server serving static files with a default config? |
@@ -341,7 +341,7 @@ http { | |||
{{ end }} | |||
|
|||
{{ range $errCode := $cfg.CustomHTTPErrors }} | |||
error_page {{ $errCode }} = @custom_{{ $errCode }};{{ end }} | |||
error_page {{ $errCode }} @custom_{{ $errCode }};{{ end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works but prevents users from customizing the error code they return via their "error backend".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO the current design works as intended and instead the error backend should be fixed.
Closing. As @pieterlange pointed out, the custom default backend is in charge of the return of the status code |
What this PR does / why we need it:
custom http error pages should return real error code instead of 200
Which issue this PR fixes
fixes #2621
Special notes for your reviewer:
related to #2285
ref: http://muratknecht.de/tech/how-to-fix-nginx-soft-404-when-a-404-error-page-returns-200/