-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Bugfix/handling headers for Authorization
and Host
#65
Conversation
Thanks. LGTM for Authorization header. For |
@yugui regarding RFC 7239: The I can split it up into two PRs, but I'm pretty swamped so I won't be able to do that until the end of the week. |
IIUC, the section is talking about |
@yugui you're correct, apologies for misreading :) The PR has been updated with use of I thought about splitting it into another PR, but the tests are slightly coupled and it was easier to do in a single PR. I can separate it out if you strongly prefer that :) |
@yugui, can you help me move this forward? :) We're maintaining that in our own fork, and would really like to have this upstream :) |
pairs = append(pairs, "authorization", val[0]) | ||
} | ||
} | ||
if req.Header.Get(xForwardedHost) != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if host := req.Header.Get(xForwardedHost); host != "" {
pairs = append(pairs, strings.ToLower(xForwardedHost), host)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Sorry for being late. Almost LGTM except several things
|
85521e5
to
878eaeb
Compare
Apologies it took me so long to get up to speed on this, we've been running this in prod for a while on our git subtree and had no time to upstream :( Updated to comply with your comment and also rebased upon master with squashing commits. |
878eaeb
to
17b6bbc
Compare
…tionbyid feat: add api.
Upstream gRPC has a bug where the HTTP2 headers aren't case sensitive. As such, if you call the HTTP1.1 endpoint of GRPC-GW with
Authorization: Bearer foo
, this will be translated into aAuthorization
field of the gRPC Metadata on the server. It means that code written to understandauthorization
header (e.g. based on the gRPC credentials/oauth) won't work:upstream bug: grpc/grpc-go#415
Add a work around by setting the
authorization
header to lower case. Additionally add propagation of theHost
header.Add tests.