Skip to content

proxy protocol: Add http support. - #16598

Merged
alyssawilk merged 7 commits into
envoyproxy:mainfrom
wez470:http-proxy-proto
Jun 1, 2021
Merged

alyssawilk merged 7 commits into
envoyproxy:mainfrom
wez470:http-proxy-proto

Conversation

@wez470

@wez470 wez470 commented May 20, 2021 •

Copy link
Copy Markdown
Contributor

Signed-off-by: Weston Carlson [email protected]

Commit Message: Add http proxy proto support.
Additional Description: The main addition here is setting the proxy protocol filter state information so that the upstream proxy proto transport socket can use that info to properly generate the header.
Risk Level: medium?
Testing: functional, integration
Docs Changes: Added details to IP Transparency page for using proxy proto with HTTP
Release Notes: Added note for http proxy proto support
Fixes #15463

Signed-off-by: Weston Carlson <[email protected]>
@wez470
wez470 requested a review from alyssawilk as a code owner May 20, 2021 16:13
wez470 added 2 commits May 20, 2021 10:26
Signed-off-by: Weston Carlson <[email protected]>
@mattklein123

Copy link
Copy Markdown
Member

cc @ggreenway who is looking at related proxy proto issues.

As I mentioned in the linked issue, I don't think this change by itself makes sense. Because of how Envoy decouples the upstream connection pool from the downstream connection and does keep alive, this change will end up sending requests for different clients to an upstream connection that has the wrong proxy proto already sent. The only way this makes sense is if we have a dedicated connection pool / connection for each unique downstream client. Iirc this is actually possible with various config options, but imo at minimum we need to document this, and even then it's so prone to breaking I would rather enforce in code somehow.

@ggreenway

Copy link
Copy Markdown
Member

I agree there are a lot of caveat's, but it's neccessary if one doesn't control the upstream, and the upstream expects PROXY protocol.

Definitely need good docs at a minimum. Ideally, there would be a mechanism to close the upstream connection(s) when the downstream connection closes. I'm not exactly sure how this would be implemented. An alternative is documenting (or enforcing) and low idle timeout on the upstream connections. This would be a case where global config validation (not per-filter) is useful.

@wez470

wez470 commented May 21, 2021

Copy link
Copy Markdown
Contributor Author

Shouldn't the connection pool be unique for clients due to the proxy proto header info being in the hash? i.e. https://github.com/envoyproxy/envoy/pull/13768/files#diff-54d8fe86c68f5ce79e1ebcf1994b13096632b8897b26591910b86a2b05e50064R47.

Agree on it being ideal if upstream connection was closed when downstream was closed. I could potentially look into that more but would also be open to the low timeout / documentation approach. Just wanted to confirm my understanding, we don't have a global validator currently, right?

@mattklein123

mattklein123 commented May 21, 2021 •

Copy link
Copy Markdown
Member

Ok sorry I forgot that the proxy proto setting already effects the hash. Part of me wonders of this change should be config guarded, which could then be used to pivot on extra checks? I have a few other concerns but let me follow up with @ggreenway first offline.

@alyssawilk alyssawilk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oh that was much cleaner and easier than expected - all the prior work here really paid off :-)

+1 to more docs. Itd probably be worth calling out in release notes you do this by using setting the (reflink) proxy protocol filter. It's also worth calling out the hit upstream will take to connection resue.

Signed-off-by: Weston Carlson <[email protected]>

@alyssawilk alyssawilk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the docs! PR LGTM modulo one tiny nit.

Signed-off-by: Weston Carlson <[email protected]>
alyssawilk
alyssawilk previously approved these changes May 26, 2021
@alyssawilk alyssawilk self-assigned this May 26, 2021
Signed-off-by: Weston Carlson <[email protected]>
@wez470

wez470 commented May 26, 2021

Copy link
Copy Markdown
Contributor Author

Sorry about dismissing your review @alyssawilk, I found one more grammar issue in the docs.

@ggreenway

Copy link
Copy Markdown
Member

I recently discovered #16682, which will also apply to http with upstream PROXY protocol. I think we should either document that this new code has this defect until that issue is fixed, or wait for the fix for that issue.

@wez470

wez470 commented May 26, 2021 •

Copy link
Copy Markdown
Contributor Author

My vote would be to document the defect and merge this for now. Mainly because the defect already exists (and for more than just proxy protocol, but it's probably the most affected) and this code mainly just fixes the proxy protocol header sent using http connection manager currently. As noted by other issues, people are trying to use this socket with http connection manager already and noticing the addresses are wrong. I could see the argument against this though being having it in the release notes might means wider adoption and more people hitting this issue.

We (Digitalocean) will likely want the memory issue fixed in the near future as well though. I could potentially look into resurrecting the idle timeout PR that would have fixed the issue, but I don't want to step on anybody's toes.

Thoughts @ggreenway?

@ggreenway

Copy link
Copy Markdown
Member

I am working on a fix for the leak right now. I'll should have a PR within a week.

I'm fine with merging this with extra docs noting the defect. Can you find a good spot where the note will be seen? Maybe also include it in the release note, and assuming this is fixed before the next release (very likely), we can edit that part out of the release note. Seem reasonable?

@wez470

wez470 commented May 27, 2021

Copy link
Copy Markdown
Contributor Author

SGTM!

@wez470

wez470 commented May 27, 2021

Copy link
Copy Markdown
Contributor Author

Ready for another look @ggreenway. I've added defect notes to the proxy protocol section that mentions the socket. Since it mainly affects pp, I thought this would be okay. I'm not sure of a more generic place to document this issue. Also added a link to the issue in the release notes.

@ggreenway ggreenway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. @alyssawilk and @mattklein123 any further comments?

@alyssawilk

Copy link
Copy Markdown
Contributor

Still LGTM! Matt you OK merging with the defect given docs?

@mattklein123 mattklein123 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks.

@alyssawilk
alyssawilk merged commit dcee6e2 into envoyproxy:main Jun 1, 2021
@wez470
wez470 deleted the http-proxy-proto branch June 1, 2021 19:50
@wez470

wez470 commented Jun 1, 2021

Copy link
Copy Markdown
Contributor Author

Thanks everyone for taking the time to review!

leyao-daily pushed a commit to leyao-daily/envoy that referenced this pull request Sep 30, 2021
Commit Message: Add http proxy proto support.
Additional Description: The main addition here is setting the proxy protocol filter state information so that the upstream proxy proto transport socket can use that info to properly generate the header.
Risk Level: medium?
Testing: functional, integration
Docs Changes: Added details to IP Transparency page for using proxy proto with HTTP
Release Notes: Added note for http proxy proto support
Fixes envoyproxy#15463
Signed-off-by: Weston Carlson <[email protected]>
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.

Expose PROXY protocol headers for HTTP Connection Manager

4 participants