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

Camunda can't map paths without a trailing slash #3889

Closed
3 tasks done
GabrielJuliao opened this issue Oct 21, 2023 · 4 comments
Closed
3 tasks done

Camunda can't map paths without a trailing slash #3889

GabrielJuliao opened this issue Oct 21, 2023 · 4 comments
Assignees
Labels
scope:spring-boot Changes to the Spring Boot starter. type:bug Issues that describe a user-facing bug in the project. version:7.20.2 version:7.21.0-alpha2 version:7.21.0

Comments

@GabrielJuliao
Copy link

GabrielJuliao commented Oct 21, 2023

Environment (Required on creation)

Camunda Spring Boot Starter

Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket)

Camunda can't map paths without a trailing slash. The issue was found in an existing application, however, it can be reproduced with a freshly generated project. With the below configuration:

Screenshot 2023-10-21 at 2 18 16 AM

Observed Behavior (Required on creation)

As you can see below, if you don't send the request with a trailing slash, camunda can't map the path and returns a 404.

Screenshot 2023-10-21 at 2 13 04 AM

The following paths result in a 404 error:

  • localhost:8080/camunda/app
  • localhost:8080/camunda/app/cockpit
  • localhost:8080/camunda/app/admin
  • localhost:8080/camunda/app/tasklist
  • localhost:8080/camunda/app/welcome

Expected behavior (Required on creation)

Camunda handles the request regardless of the presence or absence of a trailing slash.

Root Cause (Required on prioritization)

Spring Boot 3 does not automatically match trailing slashes anymore, and the option to enable it is deprecated. See corresponding issue.
The registered filters and redirect mappings are registered for paths including the trailing slashes.

Solution Ideas

  1. Register a filter that includes a trailing slash if not present already. It should probably be placed early in the filter chain. Maybe directly after setting the app path.
  2. Add redirect mappings for the failing paths:
registry.addRedirectViewController(applicationPath + "/app", applicationPath + "/app/");
registry.addRedirectViewController(applicationPath + "/app/**", applicationPath + "/app/**/");

Tasks

Preview Give feedback
  1. ci:spring-boot scope:spring-boot
    mboskamp
@GabrielJuliao GabrielJuliao added the type:bug Issues that describe a user-facing bug in the project. label Oct 21, 2023
@mboskamp mboskamp self-assigned this Oct 24, 2023
@mboskamp
Copy link
Member

HI @GabrielJuliao,
Thank you for opening this bug report. It seems you removed the section headers from the template, which made it a bit hard to read. I tried to add them again. Could you please check if I got you right?

Regarding the issue you were facing. We will try to reproduce it and check the root-cause. If you are up to providing a pull request, we will gladly accept it. In that case, please let me know by adding a comment here. I can assist you with questions if necessary.

Cheers,
Miklas

@mboskamp mboskamp changed the title 404 camunda can't map paths without a trailing slash Camunda can't map paths without a trailing slash Oct 26, 2023
@mboskamp mboskamp assigned tasso94 and unassigned mboskamp Oct 26, 2023
@mboskamp
Copy link
Member

Assigned to @tasso94 for prioritization.

@tasso94 tasso94 added version:7.21.0 potential:7.20.2 scope:spring-boot Changes to the Spring Boot starter. labels Oct 30, 2023
@tasso94 tasso94 removed their assignment Oct 30, 2023
@tasso94
Copy link
Member

tasso94 commented Oct 30, 2023

Hi @mboskamp,

Thanks for root causing this and for providing solution ideas.

Scheduled for one of the next patch releases and 7.21.0.

@mboskamp
Copy link
Member

mboskamp commented Nov 17, 2023

@tasso94 raised the following points:

  • We should avoid having two places where we define paths.
  • The filter should only apply to the few broken paths. For example, a request to /foo/bar/baz/app/admin should not invoke the filter.

I removed the paths list in the filter and instead registered the filter for all the paths we want to redirect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:spring-boot Changes to the Spring Boot starter. type:bug Issues that describe a user-facing bug in the project. version:7.20.2 version:7.21.0-alpha2 version:7.21.0
Projects
None yet
Development

No branches or pull requests

4 participants