non-angular cors error 6

-1

I'm having this error in a project:

Failed to load http://127.0.0.1:8000/hqi/pages: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:4200' is therefore not allowed access. 

And I can not seem to figure it out, I followed some examples that taught you how to create a proxy file:

const proxy = [
{
   context: '/hqi',
   target: 'http://localhost:8000'
}];
module.exports = proxy;

But it did not work, the error persists, could anyone help me?

    
asked by anonymous 11.10.2018 / 15:31

2 answers

2

Add the following header in your backend response.

httpResponse.setHeader("Access-Control-Allow-Origin", "*");

    
11.10.2018 / 15:42
2

Probably the problem is in your backend, which language are you using? You need to set the 'Access-Control-Allow-Origin' header with the value '*' on your backend, this varies from language to language, put your backend code here so we can get an idea.

    
11.10.2018 / 16:26