DEV Community

Discussion on: Bypassing CORS via custom proxy backend

Collapse
 
julo profile image
Jules • Edited

Hey ! There is another way to bypass cors with axios. First create an instance, then change the baseURL's instance and voila ! Bye bye CORS errors.

import axios from 'axios';
export const instance = axios.create({
baseURL: 'YOUR-WEBSITE-URL.COM'
});

Collapse
 
shifi profile image
Shifa Ur Rehman

I had to make an account for this but Oh God! you're such a love!

Collapse
 
bugb profile image
bugb

nice

Collapse
 
furqansafdar profile image
Furqan Safdar

Sounds interesting, if you can explain it little further.