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

Add option to forward headers on redirect #1119

Open
hugo-advizr opened this issue Jul 29, 2022 · 0 comments
Open

Add option to forward headers on redirect #1119

hugo-advizr opened this issue Jul 29, 2022 · 0 comments

Comments

@hugo-advizr
Copy link

Feature Request

Today, when following redirects on Android, the headers passed to downloadFile() method are not forwarded on the second request that follows the redirect.
I understand that, by design, most http clients don't forward the headers be default for security reasons. My suggestion is to add a configuration parameter to allow the developer to allow this to happen.

Why it is needed

When dealing with URLs that require an authorisation header this makes the request ending up as Unauthorised.

Possible implementation

Set the initial request properties on the connection that follows the redirect if a new parameter (e.g. forwardHeadersOnRedirect) is true:
https://github.com/itinance/react-native-fs/blob/master/android/src/main/java/com/rnfs/Downloader.java#L79

Code sample

RNFS.downloadFile({ forwardHeadersOnRedirect: true, ... })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant