6

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?

1

1 Answer 1

9

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.