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

agent: Error out if an agent request to the proxy results in a redirect that changes the request method #20

Open
ojarjur opened this issue Jan 14, 2019 · 1 comment · May be fixed by #69
Labels
agent Issues specific to the inverting proxy agent

Comments

@ojarjur
Copy link
Collaborator

ojarjur commented Jan 14, 2019

Currently, if the agent is created with proxy URL that results in redirects, then the requests to list and read pending requests will work, but any attempts to post back the response will fail.

This is because the response is sent to the proxy with a POST request, but the redirect will cause the request method to change from POST to GET.

This is especially problematic because it is silently done. The agent thinks it is sending a POST but the proxy thinks it is getting a GET, and neither side logs anything about this change.

Ideally, we would not change the method on a redirect, but at the very least we should detect if the method has changed and report an error if that happens.

It looks like we can implement the detect-and-error approach by defining a non-nil CheckRedirect field in our http.Client struct. We can define one that compares the method of the new request against the method of the old request(s), and return an error if they do not match.

We would need to define that field on the client used for sending requests to the proxy, which is defined here

@ojarjur ojarjur added the agent Issues specific to the inverting proxy agent label Aug 20, 2019
@jan25
Copy link

jan25 commented Jun 13, 2020

I'd like to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent Issues specific to the inverting proxy agent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants