Systemjs loading for angular2 project shows "Access-Control-Allow-Origin" error when my static content is in another domain

When I use the systemjs loader with angular2, and my static content is in a different domain, I get No 'Access-Control-Allow-Origin' header is present on the requested resource.

But if I install Allow-Control-Allow-Origin: * chrome plugin, everything works fine.

full error message:

http://www.different-domain.com/app/main.js. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.example.com' is therefore not allowed access.

I added to allow access on my server and work with the usual <script>jQuery script tag and loader, so I'm sure there are no problems with the server or client. It seems that the problem is with the systemjs bootloader, which does not allow receiving data from different domains.

+4
source share

Source: https://habr.com/ru/post/1657779/


All Articles