> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/v.-spring-boot-actuator/50.-endpoints/50.7-cors-support.md).

# 50.7 CORS支持

[跨域资源共享](https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)（CORS）是一个[W3C规范](https://www.w3.org/TR/cors/)，用于以灵活的方式指定跨域请求的认证类型。如果你使用Spring MVC或者Spring WebFlux，执行器的网络端点也可以配置成支持该场景。

CORS支持默认是禁用的，只有在`management.endpoints.web.cors.allowed-origins`属性设置时才启用。以下配置允许来自`example.com`域的`GET`和`POST`调用：

```
management.endpoints.web.cors.allowed-origins=http://example.com
management.endpoints.web.cors.allowed-methods=GET,POST
```

**注** 查看[CorsEndpointProperties](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/CorsEndpointProperties.java)获取完整的配置选项列表。
