The Swagger X-GW-CORS-policy object
swagger namespace. For
example, the following code defines a complete CORS policy whose values you can substitute
at runtime using the external properties provided by the
ExternalConfigurationProviderPlugin plugin, with the string "swagger"
prepended to each of the property
names.x-gw-cors-policies:
account:
enabled: ${cors.account.enabled:true}
allowOrigins: ${cors.account.allowOrigins:any}
allowMethods: ${cors.account.allowMethods:null}
allowHeaders: ${cors.account.allowHeaders:null}
allowCredentials: ${cors.account.allowCredentials:true}
exposeHeaders: ${cors.account.exposeHeaders:null}
maxAge: ${cors.account.maxAge:1200}Required properties
| Property | Type | Description | Combination style |
|---|---|---|---|
allowOrigins |
string |
Specifies which property types PolicyCenter
allows for CORS requests. The value must be one of the following:
|
First non-null |
allowOrigins property must be one of the following
values.| String value | Means |
|---|---|
| * |
The "*" string indicates the following:
|
any |
The "
any" string indicates the following:
|
| Comma-separated list |
A comma-separated list provides a list of explicit origin values or regular expressions. PolicyCenter allows CORS requests for origins that match an element in the list, either exactly matching an allowed origin, or, matching a regular expression in the list. Use the following format for an origin string:
If the element is an explicit origin, omit the optional port value (and colon) if the port is the default port for the scheme. PolicyCenter sets the value of the Access-Control-Allow-Origin response header to the value of the Origin request header. |
Optional properties
| Property | Type | Description | Combination style |
|---|---|---|---|
enabled |
boolean |
If set to |
First non-null |
allowHeaders |
string |
A comma-separated list of request headers to allow for CORS request headers:
|
First non-null |
allowMethods |
string |
A comma-separated list of methods to allow for CORS requests:
|
First non-null |
allowCredentials |
boolean |
If set to |
First non-null |
exposeHeaders |
string |
A comma-separated list of header names to return as the value of the
Access-Control-Expose-Header responses. If you do not specify a value (or specify
|
First non-null |
maxAge |
integer |
The value to return for the Access-Control-Max-Age header:
|
First non-null |
