Skip to content

GH-10988: Align HTTP Cross-Origin with Spring MVC#11003

Merged
cppwfs merged 2 commits into
spring-projects:mainfrom
artembilan:GH-10988
May 19, 2026
Merged

GH-10988: Align HTTP Cross-Origin with Spring MVC#11003
cppwfs merged 2 commits into
spring-projects:mainfrom
artembilan:GH-10988

Conversation

@artembilan
Copy link
Copy Markdown
Member

Fixes: #10988

The Spring MVC comes with allowedOrigins as empty list and allowCredentials as false by default.
In addition, Spring MVC provides now a flexible allowedOriginPatterns

  • Fix HTTP and WebFlux module to handle the required by Spring MVC defaults for CrossOrigin configuration

Auto-cherry-pick to 7.0.x & 6.5.x

Fixes: spring-projects#10988

The Spring MVC comes with `allowedOrigins` as empty list
and `allowCredentials` as `false` by default.
In addition, Spring MVC provides now a flexible `allowedOriginPatterns`

* Fix HTTP and WebFlux module to handle the required by Spring MVC defaults for `CrossOrigin` configuration

**Auto-cherry-pick to `7.0.x` & `6.5.x`**
@artembilan artembilan requested a review from cppwfs May 15, 2026 19:52
Copy link
Copy Markdown
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Just a question and a small doc hiccup.

The default value is `pass:[*]`.
The default value is empty.
* `origin-patterns`: List of allowed origin patterns.
Alternative list to `origin` that supports more flexible
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

132 and 133 can be on the same line.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah... Copy/paste artifact from Javadocs :shame_on_me:


Starting with version 4.2, you can configure the `<http:inbound-channel-adapter>` and `<http:inbound-gateway>` with a `<cross-origin>` element.
It represents the same options as Spring MVC's `@CrossOrigin` for `@Controller` annotations and allows the configuration of cross-origin resource sharing (CORS) for Spring Integration HTTP endpoints:
It represents the same options as Spring MVC `@CrossOrigin` for `@Controller` annotations and allows the configuration of cross-origin resource sharing (CORS) for Spring Integration HTTP endpoints:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add this to the What's new doc as well, since this is a breaking change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we do not.
This is going to be back-ported down to 6.5.x.
And this is essentially a fix for already not working code.
To make it working you have to change those defaults.
Therefore everyone who uses this feature already covered, otherwise it would fail for them with those defaults rejected by clients.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Just had to ask the question.

Copy link
Copy Markdown
Contributor

@cppwfs cppwfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job.

LGTM

@cppwfs cppwfs merged commit d8e2c89 into spring-projects:main May 19, 2026
3 checks passed
spring-builds pushed a commit that referenced this pull request May 19, 2026
* GH-10988: Align HTTP Cross-Origin with Spring MVC

Fixes: #10988

The Spring MVC comes with `allowedOrigins` as empty list
and `allowCredentials` as `false` by default.
In addition, Spring MVC provides now a flexible `allowedOriginPatterns`

* Fix HTTP and WebFlux module to handle the required by Spring MVC defaults for `CrossOrigin` configuration

* Fix `http/namespace.adoc` for `One Sentence per Line`

(cherry picked from commit d8e2c89)
spring-builds pushed a commit that referenced this pull request May 19, 2026
* GH-10988: Align HTTP Cross-Origin with Spring MVC

Fixes: #10988

The Spring MVC comes with `allowedOrigins` as empty list
and `allowCredentials` as `false` by default.
In addition, Spring MVC provides now a flexible `allowedOriginPatterns`

* Fix HTTP and WebFlux module to handle the required by Spring MVC defaults for `CrossOrigin` configuration

* Fix `http/namespace.adoc` for `One Sentence per Line`

(cherry picked from commit d8e2c89)
@artembilan artembilan deleted the GH-10988 branch May 19, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable allowCredentials in the CrossOrigin and introduce originPatterns

2 participants