Skip to content

Using http filter config is disabling CORS options #38155

@ia3andy

Description

@ia3andy

Describe the bug

When using a filter, it doesn't add the CORS headers anymore.

quarkus.resteasy-reactive.path=/api

quarkus.http.filter.api.header."X-Content-Type-Options"=nosniff
quarkus.http.filter.api.header."X-Frame-Options"=deny
quarkus.http.filter.api.header."Strict-Transport-Security"=max-age=31536000; includeSubDomains
quarkus.http.filter.api.header."Content-Security-Policy"=default-src 'none';
quarkus.http.filter.api.matches=/api/.+
quarkus.http.filter.api.order=1

quarkus.http.cors=true
quarkus.http.cors.origins=/.*/

Expected behavior

The cors headers (or any header that is set up elsewhere) should be added in addition to the other headers

Actual behavior

The cors headers are removed

How to Reproduce?

Clone this and start https://github.com/ia3andy/reproducer-cors with quarkus dev

Use this in you browser console (on a tab with a different domain opened):

fetch("http://localhost:8080/api/hello").then(r => r.text()).then(console.log)

It fails with CORS error.
Remove the filter from the properties and it works.

image

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

3.5+

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions