Skip to content

Commit c44a75f

Browse files
authored
Merge pull request #107336 from mikebudzynski/apim-cors-enh
APIM: enhance the CORS policy
2 parents 5023b9f + c43043f commit c44a75f

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

articles/api-management/api-management-cross-domain-policies.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ This example demonstrates how to support pre-flight requests, such as those with
122122
|cors|Root element.|Yes|N/A|
123123
|allowed-origins|Contains `origin` elements that describe the allowed origins for cross-domain requests. `allowed-origins` can contain either a single `origin` element that specifies `*` to allow any origin, or one or more `origin` elements that contain a URI.|Yes|N/A|
124124
|origin|The value can be either `*` to allow all origins, or a URI that specifies a single origin. The URI must include a scheme, host, and port.|Yes|If the port is omitted in a URI, port 80 is used for HTTP and port 443 is used for HTTPS.|
125-
|allowed-methods|This element is required if methods other than GET or POST are allowed. Contains `method` elements that specify the supported HTTP verbs.|No|If this section is not present, GET and POST are supported.|
125+
|allowed-methods|This element is required if methods other than GET or POST are allowed. Contains `method` elements that specify the supported HTTP verbs. The value `*` indicates all methods.|No|If this section is not present, GET and POST are supported.|
126126
|method|Specifies an HTTP verb.|At least one `method` element is required if the `allowed-methods` section is present.|N/A|
127127
|allowed-headers|This element contains `header` elements specifying names of the headers that can be included in the request.|No|N/A|
128128
|expose-headers|This element contains `header` elements specifying names of the headers that will be accessible by the client.|No|N/A|
@@ -132,8 +132,8 @@ This example demonstrates how to support pre-flight requests, such as those with
132132

133133
|Name|Description|Required|Default|
134134
|----------|-----------------|--------------|-------------|
135-
|allow-credentials|The `Access-Control-Allow-Credentials` header in the preflight response will be set to the value of this attribute and affect the clients ability to submit credentials in cross-domain requests.|No|false|
136-
|preflight-result-max-age|The `Access-Control-Max-Age` header in the preflight response will be set to the value of this attribute and affect the user agents ability to cache pre-flight response.|No|0|
135+
|allow-credentials|The `Access-Control-Allow-Credentials` header in the preflight response will be set to the value of this attribute and affect the client's ability to submit credentials in cross-domain requests.|No|false|
136+
|preflight-result-max-age|The `Access-Control-Max-Age` header in the preflight response will be set to the value of this attribute and affect the user agent's ability to cache pre-flight response.|No|0|
137137

138138
### Usage
139139
This policy can be used in the following policy [sections](https://azure.microsoft.com/documentation/articles/api-management-howto-policies/#sections) and [scopes](https://azure.microsoft.com/documentation/articles/api-management-howto-policies/#scopes).

articles/api-management/api-management-howto-developer-portal.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,12 @@ Most configuration changes (for example, VNet, sign-in and product terms) requir
137137
The interactive console makes a client-side API request from the browser. You can resolve the CORS problem by adding [a CORS policy](api-management-cross-domain-policies.md#CORS) on your API(s). You can specify all the parameters manually or use wildcard `*` values. For example:
138138

139139
```XML
140-
<cors>
140+
<cors allow-credentials="true">
141141
<allowed-origins>
142-
<origin>*</origin>
142+
<origin>https://contoso.com</origin>
143143
</allowed-origins>
144-
<allowed-methods>
145-
<method>GET</method>
146-
<method>POST</method>
147-
<method>PUT</method>
148-
<method>DELETE</method>
149-
<method>HEAD</method>
150-
<method>OPTIONS</method>
151-
<method>PATCH</method>
152-
<method>TRACE</method>
144+
<allowed-methods preflight-result-max-age="300">
145+
<method>*</method>
153146
</allowed-methods>
154147
<allowed-headers>
155148
<header>*</header>

0 commit comments

Comments
 (0)