Setup Cors Plugin in Route

Hi, I am trying to add cors plugin in my route. When i consume it from postman, it return “Access-Control-Allow-Origin” but when my vue.js application try to consume the API. it returns an error like this
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.”
I see the cors documentation from this https://docs.konghq.com/hub/kong-inc/cors/
And about limitation, for route registration i just post this as param request
{
“paths”: ["/api/v1/order"],
“name” : “order-route”,
“methods”: [“GET”,“POST”,“PUT”]
}

May any one help me to fix this, thanks
Help me please @hbagdi

I have solved this.

  1. When creating Route, don’t use host property
  2. Never Forget to add OPTIONS method in each your Route
  3. Add Cors Plugin and define origin
  4. It setup well
    This one is common issue when consume from browser or from socket

© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ