Skip to content

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

@ojarjur

Description

@ojarjur

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agentIssues specific to the inverting proxy agent

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions