Is Angular $ http.defaults.useXDomain really necessary in CORS?

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

I just installed laravel and angular in different domains (for different domain, I mean that I put angular and laravel in a completely separate folder in localhost www folder. FYI I use nginx). I hit the laravel controller with the http request from angular. It just works fine, I use $ http.defaults.useXDomain or not.

Fortunately, this condition facilitates my work. but I'm still wondering if there is an explanation why this happened?

+6
source share
1 answer

No, this is not necessary. This is actually not a thing.

check him

Cors works through appropriate headers / pre-sales inquiries and answers, which you can do differently in angles.

This is more about cors.

+9
source

All Articles