ingress-nginx icon indicating copy to clipboard operation
ingress-nginx copied to clipboard

fix(custom-error-pages): support multiple accept header values

Open aslafy-z opened this issue 3 years ago • 11 comments

What this PR does / why we need it:

This PR add the ability for custom-error-pages to parse Accept headers with multiple entries. It will take the first entry that has a mime type that matches with an extension.

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation only

Which issue/s this PR fixes

How Has This Been Tested?

It was tested on kubernetes environment with the following requests:

$ curl -vv https://my-ingress.example.com/non/existing/page -H 'accept: application/json, text/html'
# returns a json output
$ curl -vv https://my-ingress.example.com/non/existing/page -H 'accept: text/html, application/json'
# returns an html output
$ curl -vv https://my-ingress.example.com/non/existing/page -H 'accept: invalid/mime, application/json'
# returns a json output
$ curl -vv https://my-ingress.example.com/non/existing/page -H 'accept: application/json'
# still returns a json output
$ curl -vv https://my-ingress.example.com/non/existing/page -H 'accept: text/html'
# still returns an html output
$ curl -vv https://my-ingress.example.com/non/existing/page -H 'accept: invalid/mime'
# still returns the configured defaultFormat output 

Checklist:

  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I've read the CONTRIBUTION guide
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

aslafy-z avatar Jan 19 '22 17:01 aslafy-z

@aslafy-z: This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jan 19 '22 17:01 k8s-ci-robot

Welcome @aslafy-z!

It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/ingress-nginx has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Jan 19 '22 17:01 k8s-ci-robot

Hi @aslafy-z. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jan 19 '22 17:01 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aslafy-z To complete the pull request process, please assign strongjz after the PR has been reviewed. You can assign the PR to them by writing /assign @strongjz in a comment when ready.

The full list of commands accepted by this bot can be found 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

k8s-ci-robot avatar Jan 19 '22 17:01 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar May 03 '22 14:05 k8s-triage-robot

Hey @iamNoah1, I had no time to look at this for now on. Will try to get some time in the next couple of weeks.

/remove-lifecycle stale

aslafy-z avatar May 03 '22 14:05 aslafy-z

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Aug 01 '22 14:08 k8s-triage-robot

/remove-lifecycle stale

aslafy-z avatar Aug 01 '22 16:08 aslafy-z

@iamNoah1: The lifecycle/frozen label cannot be applied to Pull Requests.

In response to this:

/lifecycle frozen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Aug 01 '22 16:08 k8s-ci-robot

/lifecycle active

iamNoah1 avatar Aug 01 '22 16:08 iamNoah1

This may be usefull: https://gitlab.com/jamietanna/content-negotiation-go

aslafy-z avatar Aug 05 '22 12:08 aslafy-z

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Nov 03 '22 12:11 k8s-triage-robot

/remove-lifecycle stale

aslafy-z avatar Nov 03 '22 12:11 aslafy-z

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Dec 03 '22 12:12 k8s-triage-robot

/remove-lifecycle rotten

aslafy-z avatar Oct 02 '23 12:10 aslafy-z

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
Latest commit e212c52f25adacfedf648134b2ac668270099012
Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/65509073eee9dc00084bfc74

netlify[bot] avatar Oct 02 '23 12:10 netlify[bot]

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aslafy-z Once this PR has been reviewed and has the lgtm label, please assign strongjz for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

k8s-ci-robot avatar Oct 02 '23 12:10 k8s-ci-robot

I updated the code, can you give a new look @iamNoah1 @rikatz ? Thank you

aslafy-z avatar Nov 09 '23 02:11 aslafy-z

For some reason the Helm chart tests are failing every time. Can someone help to fix this? Thank you

aslafy-z avatar Nov 10 '23 18:11 aslafy-z

/retest

aslafy-z avatar Nov 12 '23 08:11 aslafy-z

@aslafy-z: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Nov 12 '23 08:11 k8s-ci-robot