Closed yogeshvfs closed 4 years ago
I have the same problem. I am using the same CORS configuration
The POST request send Content-Type
header, which is not allowed in your CORS config. Use allowedHeaders: "*"
or allowedHeaders: ["Content-Type"]
I've created number of APIs in the following way:
routes: [{ authorization: true, path: '/v1/api/:client', cors: { origin: "*", methods: ["GET", "POST", "OPTIONS", "PUT"], allowedHeaders: [], exposedHeaders: [], credentials: false, maxAge: 3600 } aliases: { "POST /users": "user.createUser", "GET /users": "user.getUsers" } }]
I'm not able to access the APIs with Angular application running at server http://localhost:4200
With an error: Access to fetch at 'http://localhost:8000/v1/api/choclates/users' from origin 'http://localhost:8080' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: 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.