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

Handle port and IPv6 in forwarded headers #3651

Merged
merged 3 commits into from
Jul 23, 2021
Merged

Handle port and IPv6 in forwarded headers #3651

merged 3 commits into from
Jul 23, 2021

Conversation

trask
Copy link
Member

@trask trask commented Jul 22, 2021

No description provided.

if (forwarded.length() == start) {
return null;
}
if (forwarded.charAt(start) == '[') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded and https://www.rfc-editor.org/rfc/rfc7239 it seems to me that ipv6 addresses need to be quoted, for example for="[2001:db8:cafe::17]". Similarly when ipv4 address includes a port it should be quoted "192.0.2.43:47011"

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch, fixed, and yet more tests added...

@laurit laurit merged commit 83b5121 into open-telemetry:main Jul 23, 2021
@trask trask deleted the handle-port-and-ipv6-in-forwarded-headers branch July 25, 2021 22:18
@mateuszrzeszutek
Copy link
Member

Should we add the same thing to the Instrumenter API?

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.

4 participants