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 handler callback #4084

Open
muety opened this issue Sep 23, 2021 · 1 comment
Open

Redirect handler callback #4084

muety opened this issue Sep 23, 2021 · 1 comment

Comments

@muety
Copy link

muety commented Sep 23, 2021

Is your feature request related to a problem? Please describe.

By default, an Axios instance is configured to follow redirects (301, 302, 307 and 308) automatically. However, you might want to exclude certain URLs from being opened, e.g. if they might contain malicious content or so.

Describe the solution you'd like

It would be nice to be able to specify one or more URL patterns or host names which to exclude in redirects. For instance, if a redirect would point to https://someevilwebsite.tld, it would be convenient to tell Axios not to go there, but abort the request instead.

Go's http.Client comes with a CheckRedirect handler, which fulfills exactly the purpose I described above. It might serve as an inspiration.

Describe alternatives you've considered

None

Additional context

None

@muety
Copy link
Author

muety commented Sep 23, 2021

I think #980 attempted to suggest similar functionality.

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

2 participants