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

follow redirects #146

Merged
merged 1 commit into from
Nov 19, 2015
Merged

follow redirects #146

merged 1 commit into from
Nov 19, 2015

Conversation

skarbovskiy
Copy link
Contributor

close #81

mzabriskie added a commit that referenced this pull request Nov 19, 2015
@mzabriskie mzabriskie merged commit 2781ff6 into axios:master Nov 19, 2015
@mountclear
Copy link

Does anyone have an code example on how to do re-directs in axios? I'm new to axios.

@mzabriskie
Copy link
Member

Redirects will be followed automatically. This is the native behavior for XMLHttpRequest in the browser, and with this PR it is enabled for node.

If you mean how to issue a redirect on the server send a 300-308 status code with a Location header to indicate where redirection should go.

@mountclear
Copy link

Hey Mzabriskie, that's a perfect answer for me. The issue I was having was related to CORS which does not allow redirects, but I solved that using proxy.

@dublx
Copy link
Contributor

dublx commented Apr 22, 2016

Hi,
I really like Axios, but unfortunately with the follow-redirects replacement for http/https there is no way to actually NOT follow redirect.
I looked at follow-redirects, they have an option called maxRedirects that is a Integer that defaults to 5.
Unfortunately I tried to make my fork of Axios to pass that option to follow-redirects but they don't actually support doing no redirections. I know it's a bit awkward they would, given the purpose of their module but if they claim to be a drop-in replacement for http/https then Axios could possibly take this maxRedirects option. If value is 0 then use the core http/https modules rather than follow-redirects.
Does this sound reasonable?
Or if there is a simpler way to have Axios not follow a redirect please let me know!
Thanks!

@anthonydaga
Copy link

Any resolution to this?

@shllg
Copy link

shllg commented Sep 14, 2017

Any updates? Still follows redirects even with "maxRedirects=0"

@axios axios locked and limited conversation to collaborators May 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow redirects
6 participants