0

I'm facing CORS issue in node version v8.9.4. Error is -

Response to preflight request doesn't pass access control check: No 
'Access-Control-Allow-Origin' header is present on the requested 
resource. Origin 'http://localhost:4200' is therefore not allowed 
access.

At front end i'm using angular4 and have placed below code in my headers, but still facing issue.

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, 
OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-
Token');
Sheena Singla
  • 706
  • 7
  • 13

1 Answers1

0

Unfortunately, this is Chrome bug/issue: https://bugs.chromium.org/p/chromium/issues/detail?id=67743

You will have to either

  • Use another browser for testing
  • edit hosts file to assign localhost to some pseudo-domain of your choice
  • test directly from your (or another real) site, instead of on localhost
Giulio Bambini
  • 4,695
  • 4
  • 21
  • 36