Reputation: 762
I have a 404 error with my ajax req (which looks like this) :
$.ajax({
type:'GET',
url:'http://localhost:8000/auth/github',
crossDomain:true,
headers:{
'Content-Type':'application/x-www-form-urlencoded',
'Access-Control-Allow-Origin':'*'
},
success:function(data){debugger;}
});
The error looks like this on chrome : see chrome error
And like this one in firefox : see firefox error
I installed cors plugin in my browser, I've tried many changes on the headers, still got the error in my web console.
Also, when I acces my route with postman it all works fine. So I assume the problem come from my browser
Does someone knows how to fix it ?
I saw this topic with the same error but it has no answer yet : Ajax: Response for preflight has invalid HTTP status code 404
Thanks a lot !
Upvotes: 6
Views: 2956
Reputation: 762
I finally figured it out by adding in my headers accept:/. I know this is forbidden in real infra, but mine was just for school so for those who meet the same problem for a school project, just see the trick.
Upvotes: 2