From 94d59452665f9d0bcefe97df5529ddc43cbc4b61 Mon Sep 17 00:00:00 2001 From: Tony Clarke Date: Wed, 11 Jul 2018 16:30:52 -0400 Subject: [PATCH] Provide documenation on how to configure CORS in spring cloud gateway --- .../main/asciidoc/spring-cloud-gateway.adoc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/src/main/asciidoc/spring-cloud-gateway.adoc b/docs/src/main/asciidoc/spring-cloud-gateway.adoc index 2d02210b..8e1d89dd 100644 --- a/docs/src/main/asciidoc/spring-cloud-gateway.adoc +++ b/docs/src/main/asciidoc/spring-cloud-gateway.adoc @@ -971,6 +971,24 @@ The Gateway can be configured to create routes based on services registered with To enable this, set `spring.cloud.gateway.discovery.locator.enabled=true` and make sure a `DiscoveryClient` implementation is on the classpath and enabled (such as Netflix Eureka, Consul or Zookeeper). +== CORS Configuration + +The gateway can be configured to control CORS behavior. The "global" CORS configuration is a map of URL patterns to https://docs.spring.io/spring/docs/5.0.x/javadoc-api/org/springframework/web/cors/CorsConfiguration.html[Spring Framework `CorsConfiguration`]. + +.application.yml +[source,yaml] +---- +spring: + cloud: + gateway: + globalcors: + corsConfigurations: + '[/**]': + allowedOrigins: "*" +---- + +In the example above, CORS requests will be allowed from all origins for all requested paths. + == Actuator API TODO: document the `/gateway` actuator endpoint