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

Redirect from webdav server for domain alias - how to add Authorization header #311

Open
nick-gray opened this issue Aug 3, 2022 · 2 comments

Comments

@nick-gray
Copy link

nick-gray commented Aug 3, 2022

We are receiving a 302 redirect from a webdav server to another domain and axios does not (for good reasons) automatically pass the Authorization header to the redirect url.

Normally we'd disable axios from following the redirect. We could just make the specific get file/stream request using axios direct but for consistency was hoping to keep using webdav-client.

Any suggestions?

PS: this library is awesome @perry-mitchell!!

@perry-mitchell
Copy link
Owner

perry-mitchell commented Aug 21, 2022

Hi @nick-gray - What would suggest here? Would adding support for a redirectsEnabled kind of flag suffice? We could set maxRedirects to 0 under the hood by default, or something, and then allow it to be changed.

But then again, seeing as auth is dropped upon any redirect, maybe we should just disable it entirely.

I'd accept a PR for the latter (it's just a property update in the axios config).

@nick-gray
Copy link
Author

Thanks Perry for your response!

We just changed to raw axios for the retrieval of content (the only step which gave the redirect). Our code checks for a 302 and if so do the request again with the same auth header if it was a redirect domain we trust.

redirectsEnabled flag would work so long as webdav-client can share the 302 we can make another request. For backwards compatibility and flexibility its probably easier just to expose maxRedirects (or all of the axios options? :) ) so we can by choice disable redirects (in case someone has non-authenticated webdav's they are using)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants