Hi,
Have configured Allowed Headers in Cors plugin, but i’m not able to get Access-Control-Allow-Headers
in response, due to which options pre-flight call is failing.
Is there any thing wrong on the cors plugin, or do i have to configure any other parameter.
FYI, have tried enabling cors plugin on route and as well as service, dint work.
dieunb
April 23, 2020, 5:10am
2
@Irshad_G
Which kong version do you use? And do you use Kong Ingress Controller?
Please give more information about your configuration. It is better to get quick help.
@dieunb
Kong version : 2.0.3
Its community edition, installed on ubuntu with postgress
dieunb
April 25, 2020, 9:33am
4
And could you show me the cors configuration? In my kong, cors plugin config is following below:
---
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: demo-cors
namespace: default
config:
methods:
- HEAD
- GET
- POST
- PUT
- PATCH
- DELETE
headers:
- Authorization
- Content-Type
origins:
- "*"
credentials: true
plugin: cors
hbagdi
April 28, 2020, 6:12pm
5
Please ensure that you have enable the plugin on a Kubernetes service or Ingress resource.
The following guide should help:
# Using KongPlugin resource
In this guide, we will learn how to use KongPlugin resource to configure
plugins in Kong to modify requests for a specific request path.
The guide will cover configuring a plugin for a specific service, a set of Ingress rules
and for a specific user of the API.
## Installation
Please follow the [deployment](../deployment) documentation to install
Kong Ingress Controller onto your Kubernetes cluster.
## Testing connectivity to Kong
This guide assumes that `PROXY_IP` environment variable is
set to contain the IP address or URL pointing to Kong.
If you've not done so, please follow one of the
[deployment guides](../deployment) to configure this environment variable.
If everything is setup correctly, making a request to Kong should return
This file has been truncated. show original
Would you share the error ?
alanyu
February 25, 2021, 10:22am
7
@hbagdi we have the same issue with Kong Ingress Controller (Kong 2.2) in kubernetes. Anyone can help?
CORS Plugin (CORS plugin | Kong )
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: cors-app
namespace: dev
config:
origins:
- https://www.domain.com
methods:
- GET
- POST
headers:
- Accept
- Accept-Version
- Content-Length
- Content-MD5
- Content-Type
- Date
- X-Auth-Token
exposed_headers:
- X-Auth-Token
credentials: true
max_age: 3600
preflight_continue: false
plugin: cors
Ingress route
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: dev-ingress
namespace: dev
annotations:
kubernetes.io/tls-acme: "true"
cert-manager.io/cluster-issuer: letsencrypt-prod
kubernetes.io/ingress.class: kong
konghq.com/strip-path: "true"
konghq.com/protocols: https
konghq.com/https-redirect-status-code: "301"
konghq.com/plugins: cors-app
spec:
tls:
- secretName: dev-api-domain-com
hosts:
- dev.domain.com
rules:
- host: dev.domain.com
http:
paths:
- path: /user
backend:
serviceName: dev-service
servicePort: 5000