Skip to content

Issue #15096 CrossOriginHandler not returning valid headers when all headers are allowed - #15418

Open
kamilkrzywanski wants to merge 1 commit into
jetty:jetty-12.1.xfrom
kamilkrzywanski:fix/jetty-12.1.x/15096-cross-origin-allow-headers
Open

kamilkrzywanski wants to merge 1 commit into
jetty:jetty-12.1.xfrom
kamilkrzywanski:fix/jetty-12.1.x/15096-cross-origin-allow-headers

Conversation

@kamilkrzywanski

@kamilkrzywanski kamilkrzywanski commented Jul 12, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15096

If you set allowedHeaders=* on CrossOriginHandler with credentials enabled, preflight responses come back with Access-Control-Allow-Headers: *. That is not valid for credentialed CORS requests, so browsers fail the preflight. The old CrossOriginFilter already reflected Access-Control-Request-Headers in this case.

This makes CrossOriginHandler do the same: when allowed headers are *, echo the requested headers on the preflight response. Explicit header lists are unchanged.

Updated testPreflightWithWildcardCustomHeaders to check the reflected value instead of only that the header is present.

@kamilkrzywanski
kamilkrzywanski force-pushed the fix/jetty-12.1.x/15096-cross-origin-allow-headers branch 2 times, most recently from b376355 to c0c27c4 Compare July 12, 2026 11:00
@joakime joakime added the Bug For general bugs on Jetty side label Sep 25, 2026
@joakime joakime moved this to 👀 In review in Jetty 12.1.x Backlog Sep 25, 2026
… all headers are allowed

With allowedHeaders=*, preflight was always answering Access-Control-Allow-Headers: *.
That is not valid when credentials are enabled; browsers reject the preflight.
Reflect Access-Control-Request-Headers instead, same as the old CrossOriginFilter.

Signed-off-by: Kamil Krzywanski <kamilkrzywanski01@gmail.com>
@kamilkrzywanski
kamilkrzywanski force-pushed the fix/jetty-12.1.x/15096-cross-origin-allow-headers branch from c0c27c4 to befa0d0 Compare November 1, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug For general bugs on Jetty side

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

CrossOriginHandler not returning valid headers when all headers are allowed

2 participants