404 errors when deploying at a subdirectory

If I deploy a Spring boot project using Hilla at a subdirectory, e.g localhost/my-app , that results in 404 errors on the frontend side.

If I deploy it at the root url: localhost/ , then everything works

Is there any configuration setting where I can put in /my-app as the root URL?

You should be able to add server.servlet.contextPath=/my-app to your application.properties