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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With