-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement
Milestone
Description
Although #33444 has been fixed for root URLs, it looks like there is still a problem with the UrlHandlerFilter
when server.servlet.contextPath
is specified.
Here is a minimal application to reproduce it: https://github.com/bdshadow/SpringTrailingSlashTestProject
server.servlet.contextPath=/myApp
And use the following UrlHandlerFilter
:
UrlHandlerFilter filter = UrlHandlerFilter
.trailingSlashHandler("/**").wrapRequest()
.build();
And in this case, both http://localhost:8080/myApp/greeting
and http://localhost:8080/myApp/greeting
work fine, however,
http://localhost:8080/myApp
and http://localhost:8080/myApp/
don't and return 404.
Controller for the root looks like this:
@RestController
@RequestMapping("/")
public class MyController {
@GetMapping(value = {"/", "greeting"})
public String greeting() {
return "Hello world!";
}
}
ghillert
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancementA general enhancement