fatma
fatma

Reputation: 235

Best way to treat allow access-control-allow-origin in angular

I am developping an app using angular in the front and spring boot in the backend but when i send requests from front to backend i got allow access-control-allow-origin error i have added in my controller @CrossOrigin(origins = "*") and it works.So i want to know if it's a good idea to do that or not ?

Upvotes: 0

Views: 53

Answers (1)

Rise
Rise

Reputation: 1601

CORS (Cross-Origin Resource Sharing) should be allowed in back end So yes do it in spring boot and you can't treat it in Angular front end.

The @CrossOrigin annotation enables cross-origin requests only for this specific method. So it's your choice.

Upvotes: 1

Related Questions