Provide documenation on how to configure CORS in spring cloud gateway

This commit is contained in:
Tony Clarke
2018-07-11 16:30:52 -04:00
parent 9d26aba713
commit 94d5945266

View File

@@ -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