Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CORS support for functional style routes for WebFlux [SPR-15567] #20126

Closed
spring-issuemaster opened this issue May 19, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented May 19, 2017

Sumanth Chinthagunta opened SPR-15567 and commented

We have annotations support for adding CORS to routes but I cannot find support for adding CORS for functional style routes when using WebFlux.
This capability is critical for consuming REST , SSE APIs from external SPA apps build with Angular or React.


Affects: 5.0 RC1

Issue Links:

  • #20261 CORS Options request forbidden with Webflux

Referenced from: commits 1e04cdf

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented May 19, 2017

Sébastien Deleuze commented

Indeed, that makes sense, maybe via a CORS WebFilter.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 21, 2017

Sébastien Deleuze commented

Fixed via the introduction of [CorsWebFilter](https://github.com/spring-projects/spring-framework/commit/1e04cdfa7e3ac74181efe57e0674abe4690c46a1).

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 26, 2017

Sébastien Deleuze commented

I reopen this issue since a cors(CorsConfigurationSource source) method would also make sense in HandlerStrategies.Builder since as of this commit the functional router leverage @EnableWebFlux infrastracture.

Notice that it is already also possible to configure it via @EnableWebFlux + overriding WebFluxConfigurer#addCorsMappings but a dedicated way of configuring it without annotations or WebCorsFilter seems worth to provide.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 26, 2017

Sébastien Deleuze commented

After a deeper look I think what we have currently is in fact ok. WebFilter based approach should be used via HandlerStrategies.Builder for standelone WebFlux server use case, and @EnableWebFlux + overriding WebFluxConfigurer#addCorsMappings is fine for other use cases like Spring Boot apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.