Skip to content

Add support for ports on x-forwarded-for header#1675

Merged
estringana merged 4 commits into
masterfrom
estringana/support-ports-on-x-forwarded-for-header
Jul 29, 2022
Merged

Add support for ports on x-forwarded-for header#1675
estringana merged 4 commits into
masterfrom
estringana/support-ports-on-x-forwarded-for-header

Conversation

@estringana

@estringana estringana commented Jul 28, 2022

Copy link
Copy Markdown
Contributor

According to Azzure Application Gateway documentation the IPs on x-forwarded-for header
can contain the port. Our ip extraction code was not expeting ports as part of this header.

This PR fixes #1672

Description

Readiness checklist

  • (only for Members) Changelog has been added to the release document.
  • Tests added for this feature/bug.

Reviewer checklist

  • Appropriate labels assigned.
  • Milestone is set.
  • Changelog has been added to the release document. For community contributors the reviewer is in charge of this task.

According to [Azzure Application Gateway documentation](https://docs.microsoft.com/en-us/azure/application-gateway/how-application-gateway-works#modifications-to-the-request) the IPs on x-forwarded-for header
can contain the port. Our ip extraction code was not expeting ports as part of this header.

This PR fixes #1672
Comment thread ext/php7/ip_extraction.c Outdated
Comment thread ext/php8/ip_extraction.c Outdated
Comment thread tests/ext/extract_ip_addr.phpt

@bwoebi bwoebi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we've now arrived at the simplest possible implementation, LGTM :-)

@estringana
estringana marked this pull request as ready for review July 29, 2022 12:03
@estringana
estringana requested a review from a team as a code owner July 29, 2022 12:03
@estringana
estringana merged commit ea44e8b into master Jul 29, 2022
@estringana
estringana deleted the estringana/support-ports-on-x-forwarded-for-header branch July 29, 2022 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Cannot parse IP-address from X-Forwarded-For from Azure application gateway

3 participants