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

refactor(tools/http): simplify check_https() with ngx.var #13167

Merged
merged 6 commits into from
Jun 7, 2024

Conversation

chronolaw
Copy link
Contributor

@chronolaw chronolaw commented Jun 5, 2024

Summary

We used to call ngx.req.get_headers() to get all possible header values,
but since nginx 1.23.0 or OpenResty 1.25.3.1 ngx.var can get a combined value for all header values
with identical name (joined by comma), so I think that we could simplify these code.

There is one concern:
If header X-Forwarded-Proto has a comma separated value like http, https,
This PR will think it is a multiple header request and report an error Only one X-Forwarded-Proto header allowed.
But I think that it is an unlikely case in the real world.

KAG-4673

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix #[issue number]

@github-actions github-actions bot added the cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee label Jun 5, 2024
@chronolaw chronolaw force-pushed the refactor/simplify_check_https_func branch from 3b19be9 to 13af01e Compare June 5, 2024 11:25
@chronolaw chronolaw force-pushed the refactor/simplify_check_https_func branch from 13af01e to bfae91c Compare June 5, 2024 11:26
@pull-request-size pull-request-size bot added size/S and removed size/XS labels Jun 5, 2024
@pull-request-size pull-request-size bot added size/M and removed size/S labels Jun 5, 2024
@chronolaw chronolaw marked this pull request as ready for review June 5, 2024 13:04
Copy link
Member

@bungle bungle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment.

kong/tools/http.lua Outdated Show resolved Hide resolved
@ADD-SP ADD-SP merged commit 3b066dc into master Jun 7, 2024
27 checks passed
@ADD-SP ADD-SP deleted the refactor/simplify_check_https_func branch June 7, 2024 06:43
@team-gateway-bot
Copy link
Collaborator

Successfully created cherry-pick PR for master:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee size/M skip-changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants