0

I'm creating an Angular 17 application with the angular cli.

Within the Angular application (served at 'http://localhost:4200') I'm trying to access an mp3 file which resides on the Wamp64 server which I have running on my PC.

But I'm getting the following error:

    Access to fetch at 'http://localhost/sarah/projects/app_assets/mp3s/01_Electronica.mp3'
    from origin 'http://localhost:4200' has been blocked by CORS policy: 
    No 'Access-Control-Allow-Origin' header is present on the requested resource. 
    If an opaque response serves your needs, set the request's mode to 'no-cors' to 
    fetch the resource with CORS disabled.

I found some simple instructions on google to resolve the error and I have followed them but it hasn't changed anything.

Here is a link to the instructions I followed:

https://medium.com/@tanviranik/how-to-resolve-the-error-in-wampserver-no-access-control-allow-origin-header-is-present-on-the-486705cb1659

Here's what I did (according to the instructions):

  1. I enabled the "headers_module" of the Apache modules.
  2. Then in httpd.conf I added the code as per instructions in link above:httpd.conf mod_headers

I'd appreciate any help or advice.

Thank you,

Sarah

0

Browse other questions tagged or ask your own question.