How to use CORS in angular2 [duplicate]

2019-09-16 06:08发布

问题:

This question already has an answer here:

  • How to create cross-domain request? 7 answers

In angular2 how to use CORS cross domain, it is necessary to set the response header at the server, how to set?

回答1:

You need to set the cross domain origin in only server side not in client side. So enable CORS in server side.

And if you are using Web Api for a server call . Enable CORS and Access-Control-Allow-Origin.



标签: angular cors