HandlerMapping
is configured.
Both Spring Web MVC and Spring WebFlux support this annotation through the
RequestMappingHandlerMapping in their respective modules. The values
from each type and method level pair of annotations are added to a
CorsConfiguration and then default values are applied via
CorsConfiguration#applyPermitDefaultValues().
The rules for combining global and local configuration are generally
additive -- e.g. all global and all local origins. For those attributes
where only a single value can be accepted such as allowCredentials
and maxAge, the local overrides the global value.
See CorsConfiguration#combine(CorsConfiguration) for more details.
| Modifier and Type | Method and Description |
|---|---|
| public String | allowCredentials()
Whether the browser should send credentials, such as cookies along with cross domain requests, to the annotated endpoint. |
| public String[] | allowedHeaders()
The list of request headers that are permitted in actual requests,
possibly |
| public String | |
| public String[] | exposedHeaders()
The List of response headers that the user-agent will allow the client
to access on an actual response, possibly |
| public long | |
| public RequestMethod[] | |
| public String[] | |
| public String[] | |
| public String[] |
| allowCredentials | back to summary |
|---|---|
| public String allowCredentials() Whether the browser should send credentials, such as cookies along with
cross domain requests, to the annotated endpoint. Please, see
Note Be aware that this option establishes a high level of trust with the configured domains and also increases the surface attack of the web application by exposing sensitive user-specific information such as cookies and CSRF tokens. By default this is not set in which case the
| |
| allowedHeaders | back to summary |
|---|---|
| public String[] allowedHeaders() The list of request headers that are permitted in actual requests,
possibly By default all requested headers are allowed. | |
| allowPrivateNetwork | back to summary |
|---|---|
| public String allowPrivateNetwork() Whether private network access is supported. Please, see
By default this is not set (i.e. private network access is not supported).
| |
| exposedHeaders | back to summary |
|---|---|
| public String[] exposedHeaders() The List of response headers that the user-agent will allow the client
to access on an actual response, possibly By default no headers are listed as exposed. | |
| maxAge | back to summary |
|---|---|
| public long maxAge() The maximum age (in seconds) of the cache duration for preflight responses. This property controls the value of the Setting this to a reasonable value can reduce the number of preflight request/response interactions required by the browser. A negative value means undefined. By default this is set to | |
| methods | back to summary |
|---|---|
| public RequestMethod[] methods() The list of supported HTTP request methods. Please, see
By default the supported methods are the same as the ones to which a controller method is mapped. | |
| originPatterns | back to summary |
|---|---|
| public String[] originPatterns() Alternative to By default this is not set.
| |
| origins | back to summary |
|---|---|
| public String[] origins() A list of origins for which cross-origin requests are allowed. Please,
see By default all origins are allowed unless
| |
| value | back to summary |
|---|---|
| public String[] value() Alias for
| |