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

Make grpc_http1_reverse_bridge return HTTP 200. #31047

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

hq6
Copy link
Contributor

@hq6 hq6 commented Nov 24, 2023

gRPC clients expect that request status will be communicated using the gRPC status header, and that HTTP status for responses should always be 200 for properly behaving servers.

This commit updates the grpc_http1_reverse_bridge to follow this behavior.

Testing: Tested manually with grpcurl.

@yanavlasov
Copy link
Contributor

@yanavlasov
Copy link
Contributor

/wait

@hq6
Copy link
Contributor Author

hq6 commented Nov 28, 2023

@hq6 please fix DCO per these instructions https://github.com/envoyproxy/envoy/pull/31047/checks?check_run_id=19010034687

Done.

@@ -179,6 +179,9 @@ Http::FilterHeadersStatus Filter::encodeHeaders(Http::ResponseHeaderMap& headers
// We can only insert trailers at the end of data, so keep track of this value
// until then.
grpc_status_ = grpcStatusFromHeaders(headers);

// gRPC clients expect that the HTTP status will always be 200.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should do it only when it is a gRPC response. For regular HTTP responses the status should not be modified.

Also as this is a user visible change it will require a runtime flag protection.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My understanding is that if this filter is active (enabled_ is only set to true if the request headers indicate it's a gRPC request), then the response is a gRPC response. Thus, my code change only applies when it is a gRPC response.

Could you link me to an example PR or docs for enabling runtime flag protection?

Copy link
Member

Choose a reason for hiding this comment

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

@zuercher
Copy link
Member

/wait

Copy link

CC @envoyproxy/runtime-guard-changes: FYI only for changes made to (source/common/runtime/runtime_features.cc).

🐱

Caused by: #31047 was synchronize by hq6.

see: more, trace.

@hq6 hq6 force-pushed the hqin/fix_http_status_in_grpc_bridge branch from 9d9b5a5 to 91924a2 Compare December 12, 2023 20:20
@hq6
Copy link
Contributor Author

hq6 commented Dec 12, 2023

@yanavlasov @zuercher I have rebased this PR and added runtime protection as requested.

Are there additional changes you'd like to see in this PR?

zuercher
zuercher previously approved these changes Dec 15, 2023
@hq6
Copy link
Contributor Author

hq6 commented Jan 2, 2024

@yanavlasov @zuercher
Bumping this since it's been 3 weeks, and I rebased to fix the conflicts.

Are there additional changes you'd like to see in this PR?

@adisuissa
Copy link
Contributor

/retest

@adisuissa
Copy link
Contributor

@zuercher PTAL

zuercher
zuercher previously approved these changes Jan 4, 2024
@phlax
Copy link
Member

phlax commented Jan 9, 2024

@hq6 if you resolve the merge conflict this should be good to land

gRPC clients expect that request status will be communicated using the
gRPC status header, and that HTTP status for responses should always be
200 for properly behaving servers.

This commit updates the grpc_http1_reverse_bridge to follow this
behavior.

Signed-off-by: Henry Qin <[email protected]>
@phlax
Copy link
Member

phlax commented Jan 9, 2024

@hq6 if you have a reviewer preferably dont force-push

phlax
phlax previously approved these changes Jan 9, 2024
Copy link
Member

@phlax phlax left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @hq6

@phlax phlax enabled auto-merge (squash) January 9, 2024 15:42
@hq6
Copy link
Contributor Author

hq6 commented Jan 9, 2024

@hq6 if you resolve the merge conflict this should be good to land

@phlax I have resolved conflicts again, I do not have write permissions, so I cannot merge it myself.

If possible, could we get this PR stamped and merged before yet another rebase is required?

@hq6
Copy link
Contributor Author

hq6 commented Jan 9, 2024

@hq6 if you have a reviewer preferably dont force-push

Oops I saw this message too late. Sorry I'm used to following a rebase workflow and didn't realize it was causing review dismissal.

@phlax
Copy link
Member

phlax commented Jan 12, 2024

apologies @hq6 i set this to automerge but it flaked and now there is another conflict - would you mind updating again

auto-merge was automatically disabled January 16, 2024 18:37

Head branch was pushed to by a user without write access

@hq6
Copy link
Contributor Author

hq6 commented Jan 16, 2024

@phlax @zuercher Could you both stamp again?
I did not force-push this time, but GitHub still dismissed the previous review, and I'm not entirely sure why.

@zuercher zuercher merged commit 7a86e8a into envoyproxy:main Jan 18, 2024
56 of 57 checks passed
hq6 added a commit to hq6/envoy that referenced this pull request Jul 23, 2024
This commit removes the runtime flag introduced in envoyproxy#31047 since it has
been 6 months since that change.

Signed-off-by: Henry Qin <[email protected]>
hq6 added a commit to hq6/envoy that referenced this pull request Jul 25, 2024
This commit removes the runtime flag introduced in envoyproxy#31047 since it has
been 6 months since that change.

Signed-off-by: Henry Qin <[email protected]>
@hq6 hq6 mentioned this pull request Jul 25, 2024
yanavlasov pushed a commit that referenced this pull request Jul 25, 2024
…p_status

This commit removes the runtime flag introduced in #31047 since it has
been 6 months since that change.

Signed-off-by: Henry Qin <[email protected]>
martinduke pushed a commit to martinduke/envoy that referenced this pull request Aug 8, 2024
…p_status

This commit removes the runtime flag introduced in envoyproxy#31047 since it has
been 6 months since that change.

Signed-off-by: Henry Qin <[email protected]>
Signed-off-by: Martin Duke <[email protected]>
asingh-g pushed a commit to asingh-g/envoy that referenced this pull request Aug 20, 2024
…p_status

This commit removes the runtime flag introduced in envoyproxy#31047 since it has
been 6 months since that change.

Signed-off-by: Henry Qin <[email protected]>
Signed-off-by: asingh-g <[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.

5 participants