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 1 commit into from Nov 19, 2015


Copy link

commented Nov 6, 2015

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

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

This comment has been minimized.

Copy link

commented Feb 15, 2016

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


This comment has been minimized.

Copy link

commented Feb 25, 2016

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.


This comment has been minimized.

Copy link

commented Mar 1, 2016

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.


This comment has been minimized.

Copy link

commented Apr 22, 2016

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!


This comment has been minimized.

Copy link

commented Jun 12, 2017

Any resolution to this?


This comment has been minimized.

Copy link

commented Sep 14, 2017

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

@alshakero alshakero referenced this pull request Dec 11, 2017


Handling redirections #187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
6 participants
You can’t perform that action at this time.