문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top