Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

chestack
Copy link

@chestack chestack commented Jun 11, 2018

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/

custom http error pages should return real error code instead of 200
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 11, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chestack
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: aledbf

Assign the PR to them by writing /assign @aledbf in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@chestack
Copy link
Author

@aledbf , please help review

@codecov-io
Copy link

Codecov Report

Merging #2620 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f74d063...7c57aef. Read the comment docs.

@antoineco
Copy link
Contributor

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 }}
Copy link
Contributor

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".

Copy link
Contributor

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.

@aledbf
Copy link
Member

aledbf commented Jun 11, 2018

Closing. As @pieterlange pointed out, the custom default backend is in charge of the return of the status code

@aledbf aledbf closed this Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
6 participants