http-add-on
http-add-on copied to clipboard
Ensuring that the proper host is set on all Location headers
This PR changes the behavior of the interceptor when the app returns a Location
header that does not have a host on it (i.e. Location: "/abc"
).
Prior to this patch, the interceptor simply passed this value back to the client, but now, it ensures that the incoming host value is prepended to the final header. This new behavior ensures that in all circumstances where an app intends to return a Location
header, a Location
header will be returned to the client with the proper hostname in it.
Checklist
- [x] Commits are signed with Developer Certificate of Origin (DCO)
- [x] Any necessary documentation is added, such as:
-
README.md
-
The
docs/
directory - The docs repo
-
Fixes #331
@obito @benjaminwood here is a proposed solution to #331. A short overview of what this is doing is in the description of the PR above. is in the Can you folks take a look and let me know what you think?
An alternative to this PR is to avoid overwriting the request host here (similar to something you suggested @obito). I'd like to hear what you both think about that also, if you don't mind.
cc/ @asw101
I'll try it out and follow up!
@benjaminwood thank you kindly!
Any follow up on this ?
@arschles Hi! I just stumbled across this issue and instead of opening a new one, it might make sense to follow up on this one first: I think I have a scenario where the original host header should have been kept while forwarding the request to the target pod:
I have a web service that is hostname-aware and changes behavior based on it. Unfortunately it cannot be configured to use the x-forwarded-for header, which indeed contains the correct, original request hostname.
For example: My original request was https://foo.bar.com. Without KEDA (Only with nginx ingress) my target pod sees "foo.bar.com" as the hostname (no x-forwarded-for header is set). After enabling KEDA with the http-add-on the target pod only sees "foo.default".
Is there a way to configure that behavior so the proxy preserves the original hostname? Thanks in advance - max