-
Notifications
You must be signed in to change notification settings - Fork 16
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
Configurable target URI rewrites #58
Conversation
If the maintainers agree with this approach, then I'd be happy to add some tests to exercise it. |
Then the encapsulated HTTP requests | ||
|
||
```http | ||
POST /some-cool-api HTTP/1.1 |
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.
I don't see this happening in the code change.
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.
Yeah, I will add a test that exercises the target rewrite feature before merging this.
The documentation should clarify whether the set up described is suitable for production OHTTP deployment.
The approach seems reasonable, go ahead and work on tests. Are unit tests feasible? |
As I explained in #56, I do want this for production setups, assuming the maintainers agree this isn't dangerous in some way I haven't seen.
Yeah, I can copy some setup from the existing tests to exercise this. |
e18657a
to
b32e410
Compare
@@ -5,11 +5,13 @@ package main | |||
|
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.
I had to refactor these tests a little because the mock gateway created in createMockEchoGatewayServer
never actually used FilteredHttpRequestHandler
, which is where both forbidden/allowed origins and target rewrites are implemented. Now, instead of using ForbiddenCheckHttpRequestHandler
which would just fire metrics and send a canned response, we wire MockHttpRequestHandler
into ProtoHTTPAppHandler
or BinaryHTTPAppHandler
. FilteredHttpRequestHandler
takes an implementation of interface HttpRequestHandler
so that we can swap out MockHttpRequestHandler
instead of a real http.Client
.
Looks good to me. Just need approval from a second owner. |
in my queue. |
b32e410
to
f671f01
Compare
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.
Change looks pretty good, just one question.
Plus: unfortunately we have a mix of "Http" and "HTTP" in this codebase. For new variables I'd like to lean towards "HTTP" as it matches Go convention.
LGTM, @tgeoghegan. Please squash and I'll merge. |
Add a `TARGET_REWRITES` environment variable that allows rewriting the URI in an encapsulated request. See changes to `README.md` for discussion of motivation and utilization.
cffaa3f
to
4fe2130
Compare
Add a
TARGET_REWRITES
environment variable that allows rewriting the URI in an encapsulated request. See changes toREADME.md
for discussion of motivation and utilization.Closes #56