Adds support for other Cors directives
CORS annotations improvements Cors improvements Cors improevements Cors improvements Cors improvements
This commit is contained in:
parent
99a355f25d
commit
2097676ca8
10 changed files with 277 additions and 83 deletions
|
|
@ -52,12 +52,20 @@ Key:
|
|||
| `base-url-scheme` | Specify the scheme of the `<base>` tags. | | nginx
|
||||
| `preserve-host` | Whether to pass the client request host (`true`) or the origin hostname (`false`) in the HTTP Host field. | | trafficserver
|
||||
|
||||
## CORS Related
|
||||
| Name | Meaning | Default | Controller
|
||||
| --- | --- | --- | --- |
|
||||
| `enable-cors` | Enable CORS headers in response. | false | nginx, voyager
|
||||
| `cors-allow-origin` | Specifies the Origin allowed in CORS (Access-Control-Allow-Origin) | * | nginx
|
||||
| `cors-allow-headers` | Specifies the Headers allowed in CORS (Access-Control-Allow-Headers) | DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization | nginx
|
||||
| `cors-allow-methods` | Specifies the Methods allowed in CORS (Access-Control-Allow-Methods) | GET, PUT, POST, DELETE, PATCH, OPTIONS | nginx
|
||||
| `cors-allow-credentials` | Specifies the Access-Control-Allow-Credentials | true | nginx
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
| Name | Meaning | Default | Controller
|
||||
| --- | --- | --- | --- |
|
||||
| `configuration-snippet` | Arbitrary text to put in the generated configuration file. | | nginx
|
||||
| `enable-cors` | Enable CORS headers in response. | | nginx, voyager
|
||||
| `limit-connections` | Limit concurrent connections per IP address[1]. | | nginx, voyager
|
||||
| `limit-rps` | Limit requests per second per IP address[1]. | | nginx, voyager
|
||||
| `limit-rpm` | Limit requests per minute per IP address. | | nginx, voyager
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ The following annotations are supported:
|
|||
|[ingress.kubernetes.io/configuration-snippet](#configuration-snippet)|string|
|
||||
|[ingress.kubernetes.io/default-backend](#default-backend)|string|
|
||||
|[ingress.kubernetes.io/enable-cors](#enable-cors)|true or false|
|
||||
|[ingress.kubernetes.io/cors-allow-origin](#enable-cors)|string|
|
||||
|[ingress.kubernetes.io/cors-allow-methods](#enable-cors)|string|
|
||||
|[ingress.kubernetes.io/cors-allow-headers](#enable-cors)|string|
|
||||
|[ingress.kubernetes.io/cors-allow-credentials](#enable-cors)|true or false|
|
||||
|[ingress.kubernetes.io/force-ssl-redirect](#server-side-https-enforcement-through-redirect)|true or false|
|
||||
|[ingress.kubernetes.io/from-to-www-redirect](#redirect-from-to-www)|true or false|
|
||||
|[ingress.kubernetes.io/limit-connections](#rate-limiting)|number|
|
||||
|
|
@ -162,6 +166,26 @@ This is a global configuration for the ingress controller. In some cases could b
|
|||
### Enable CORS
|
||||
|
||||
To enable Cross-Origin Resource Sharing (CORS) in an Ingress rule add the annotation `ingress.kubernetes.io/enable-cors: "true"`. This will add a section in the server location enabling this functionality.
|
||||
|
||||
CORS can be controlled with the following annotations:
|
||||
|
||||
* `ingress.kubernetes.io/cors-allow-methods` controls which methods are accepted. This is a multi-valued field, separated by ',' and accepts only letters (upper and lower case).
|
||||
|
||||
Example: `ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"`
|
||||
|
||||
* `ingress.kubernetes.io/cors-allow-headers` controls which headers are accepted. This is a multi-valued field, separated by ',' and accepts letters, numbers, _ and -.
|
||||
|
||||
Example: `ingress.kubernetes.io/cors-allow-methods: "X-Forwarded-For, X-app123-XPTO"`
|
||||
|
||||
* `ingress.kubernetes.io/cors-allow-origin` controls what's the accepted Origin for CORS and defaults to '*'. This is a single field value, with the following format: http(s)://origin-site.com or http(s)://origin-site.com:port
|
||||
|
||||
Example: `ingress.kubernetes.io/cors-allow-origin: "https://origin-site.com:4443"`
|
||||
|
||||
* `ingress.kubernetes.io/cors-allow-credentials` controls if credentials can be passed during CORS operations.
|
||||
|
||||
Example: `ingress.kubernetes.io/cors-allow-credentials: "true"`
|
||||
|
||||
|
||||
For more information please check https://enable-cors.org/server_nginx.html
|
||||
|
||||
### Server Alias
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue