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

Adding redirectLocationTrusted option to retain authorization header on redirect domain change #2876

Closed

Conversation

gareth-robinson
Copy link

@gareth-robinson gareth-robinson commented Feb 19, 2018

PR Checklist:

PR Description

If a redirect location has a different domain than the original request (excluding port and protocol changes) then any authorization header is removed from the request. This is currently a deliberate choice in the code, to do the same as curl (for security reasons), as per this comment: https://github.com/request/request/blob/master/lib/redirect.js#L134

Curl does have an option --location-trusted for overriding that behaviour though: (https://curl.haxx.se/docs/manpage.html#--location-trusted) so this pull request is to add an equivalent option redirectLocationTrusted to request. If not supplied this option defaults to false, keeping the original behaviour.

In this change I've kept redirectLocationTrusted as the simple boolean that curl has. It could be overloaded for finer grained options (e.g. a domain matching regex) if it was felt that would be of more value.

@gareth-robinson
Copy link
Author

Bleurgh, it worked locally with node 6.12 :( but travis CI is failing. Will investigate.

@gareth-robinson
Copy link
Author

Raised #2877 to discuss fixing the Travis CI issues

@stale
Copy link

stale bot commented Jun 5, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 5, 2019
@stale stale bot closed this Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant