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

Unable to use custom handlers for HTTP OPTIONS method in subresources #45173

Closed
mabartos opened this issue Dec 17, 2024 · 3 comments · Fixed by #45174
Closed

Unable to use custom handlers for HTTP OPTIONS method in subresources #45173

mabartos opened this issue Dec 17, 2024 · 3 comments · Fixed by #45174
Labels
area/rest kind/bug Something isn't working
Milestone

Comments

@mabartos
Copy link
Contributor

Describe the bug

[Breaking change in 3.15.2 minor release]

After merging #43440, we (Keycloak) are not able to use our custom logic for handling the HTTP OPTIONS method in Quarkus REST subresources. When there's an HTTP request with the OPTIONS method made for a subresource that does not explicitly contain a handler annotated with @OPTIONS, default values are immediately returned. However, when some specific handlers are nested deeper in subresources, they are not taken into account.

Previously, all subresources were traversed and checked whether they contain the handler for @HEAD, and @OPTIONS HTTP methods.

Expected behavior

Use custom nested handlers for @OPTIONS and @HEAD HTTP methods.

Actual behavior

NOT POSSIBLE to use custom nested handlers for @OPTIONS and @HEAD HTTP methods.

How to Reproduce?

  1. Have custom handlers for OPTIONS and HEAD methods in sub-resources
  2. Make an OPTIONS/HEAD HTTP request for them, or leverage preflight logic
  3. See the custom handler is not executed, but some default response is returned

Output of uname -a or ver

Linux mabartos 6.11.9-100.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Nov 17 18:52:19 UTC 2024 x86_64 GNU/Linux

Output of java -version

openjdk 21.0.3 2024-04-16 LTS OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)

Quarkus version or git rev

3.15.2

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

Maven 3.9.8

Additional information

I'll provide a PR for this.

Maybe it would be good to go through the same case in the ClassRoutingHandler containing also the default mechanisms for OPTIONS/HEAD. But it's out of scope of this issue.

@mabartos
Copy link
Contributor Author

@geoand @cescoffier Could you please check it?

@mabartos
Copy link
Contributor Author

It should be backported to 3.15.x

Copy link

quarkus-bot bot commented Dec 17, 2024

/cc @FroMage (rest), @stuartwdouglas (rest)

mabartos added a commit to mabartos/quarkus that referenced this issue Dec 17, 2024
mabartos added a commit to mabartos/quarkus that referenced this issue Dec 17, 2024
mabartos added a commit to mabartos/quarkus that referenced this issue Dec 17, 2024
@geoand geoand closed this as completed in 349d540 Dec 18, 2024
@quarkus-bot quarkus-bot bot added this to the 3.18 - main milestone Dec 18, 2024
@gsmet gsmet modified the milestones: 3.18 - main, 3.17.5 Dec 18, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants