spring-framework / org.springframework.web.cors.reactive

Package org.springframework.web.cors.reactive

Types

CorsUtils

abstract class CorsUtils

Utility class for CORS reactive request handling based on the CORS W3C recommendation.

CorsWebFilter

open class CorsWebFilter : WebFilter

WebFilter that handles CORS preflight requests and intercepts CORS simple and actual requests thanks to a CorsProcessor implementation (DefaultCorsProcessor by default) in order to add the relevant CORS response headers (like Access-Control-Allow-Origin) using the provided CorsConfigurationSource (for example an UrlBasedCorsConfigurationSource instance.

This is an alternative to Spring WebFlux Java config CORS configuration, mostly useful for applications using the functional API.

DefaultCorsProcessor

open class DefaultCorsProcessor : CorsProcessor

The default implementation of CorsProcessor, as defined by the CORS W3C recommendation.

Note that when input CorsConfiguration is null, this implementation does not reject simple or actual requests outright but simply avoid adding CORS headers to the response. CORS processing is also skipped if the response already contains CORS headers, or if the request is detected as a same-origin one.

UrlBasedCorsConfigurationSource

open class UrlBasedCorsConfigurationSource : CorsConfigurationSource

Provide a per reactive request CorsConfiguration instance based on a collection of CorsConfiguration mapped on path patterns.

Exact path mapping URIs (such as "/admin") are supported as well as Ant-style path patterns (such as "/admin/**").