I have Spring boot-starter-web application with a bunch of RestControllers. It seems that Spring, by default, has some mechanism to redirect requests without a trailing slash to the same request with a trailing slash. So, the following request:
GET http://server/context-name
results in a 302 response with the following location header:
Location: http://server/context-name/
Is there a way to disable this behaviour? I would be happy with a 404 response, but I do not want a redirect.
EDIT: After some research I found out that it's probably Tomcat that is doing the redirect. In a standalone Tomcat this behaviour can be configured with mapperContextRootRedirectEnabled
(see Tomcat docs) but I can't figure out how to do this for an embedded Tomcat.