Skip to content

Commit

Permalink
fix: update redirect logic to also update path (#4055)
Browse files Browse the repository at this point in the history
* fix: update redirect logic to also update path

When a 307 redirect comes in, it contains the new, full URL for the location change.
The current logic respects this for the `Host` header that gets sent, but it does not
then update the path, leading to possibly invalid redirects. The new logic pulls the
path out of the endpoint and updates the outgoing request.
  • Loading branch information
CaerusKaru authored Apr 1, 2024
1 parent 030888f commit 8a82af5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-event-listeners-536ce342.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "event listeners",
"description": "Configures the endpoint path for redirect requests, instead of just the hostname, allowing for proper redirects."
}
1 change: 1 addition & 0 deletions lib/event_listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ AWS.EventListeners = {
this.httpRequest.endpoint =
new AWS.Endpoint(resp.httpResponse.headers['location']);
this.httpRequest.headers['Host'] = this.httpRequest.endpoint.host;
this.httpRequest.path = this.httpRequest.endpoint.path;
resp.error.redirect = true;
resp.error.retryable = true;
}
Expand Down

0 comments on commit 8a82af5

Please sign in to comment.