Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it Angular $http.defaults.useXDomain really neccessary in CORS?

I saw someone using $http.defaults.useXDomain = true in angular when dealing with CORS. Is it really necessary to do that?

I just set up laravel and angular in different domain ( By different domain, I mean I put angular and laravel in completely separated folder in localhost www folder. FYI i use nginx). i hit the laravel controller with http request from angular. It just work fine, Whether i use the $http.defaults.useXDomain or not.

Luckily, this condition make my work little bit easier. but i still wondering is there any explanation why this happened?

like image 855
under5hell Avatar asked Apr 18 '14 04:04

under5hell


1 Answers

No, it's not necessary. In fact, it's not a thing.

check it out

Cors works via proper headers/preflight requests and responses, which you can do myriad of different ways in angularjs.

Here is more about cors workings.

like image 124
J.Wells Avatar answered Nov 15 '22 05:11

J.Wells