CorsRule
A rule for a CORS policy. You can add up to 100 rules to a CORS policy. If more than one rule applies, the service uses the first applicable rule listed.
Contents
- AllowedHeaders
-
Specifies which headers are allowed in a preflight
OPTIONS
request through theAccess-Control-Request-Headers
header. Each header name that is specified inAccess-Control-Request-Headers
must have a corresponding entry in the rule. Only the headers that were requested are sent back.This element can contain only one wildcard character (*).
Type: Array of strings
Array Members: Minimum number of 0 items. Maximum number of 100 items.
Length Constraints: Minimum length of 1. Maximum length of 8192.
Pattern:
[\u0009\u000A\u000D\u0020-\u00FF]+
Required: Yes
- AllowedOrigins
-
One or more response headers that you want users to be able to access from their applications (for example, from a JavaScript
XMLHttpRequest
object).Each CORS rule must have at least one
AllowedOrigins
element. The string value can include only one wildcard character (*), for example, http://*.example.com. Additionally, you can specify only one wildcard character to allow cross-origin access for all origins.Type: Array of strings
Array Members: Minimum number of 1 item. Maximum number of 100 items.
Length Constraints: Minimum length of 1. Maximum length of 2048.
Pattern:
[\u0009\u000A\u000D\u0020-\u00FF]+
Required: Yes
- AllowedMethods
-
Identifies an HTTP method that the origin that is specified in the rule is allowed to execute.
Each CORS rule must contain at least one
AllowedMethods
and oneAllowedOrigins
element.Type: Array of strings
Array Members: Minimum number of 1 item. Maximum number of 4 items.
Valid Values:
PUT | GET | DELETE | HEAD
Required: No
- ExposeHeaders
-
One or more headers in the response that you want users to be able to access from their applications (for example, from a JavaScript
XMLHttpRequest
object).This element is optional for each rule.
Type: Array of strings
Array Members: Minimum number of 0 items. Maximum number of 100 items.
Length Constraints: Minimum length of 1. Maximum length of 8192.
Pattern:
[\u0009\u000A\u000D\u0020-\u00FF]+
Required: No
- MaxAgeSeconds
-
The time in seconds that your browser caches the preflight response for the specified resource.
A CORS rule can have only one
MaxAgeSeconds
element.Type: Integer
Valid Range: Minimum value of 0. Maximum value of 2147483647.
Required: No
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: