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?

Try

server.servlet.context-path=/my-app

Where does that go @adaptable-uakari - in application.yml?

Yes. This is in properties format

Yaml would be in new lines

the 404 is in the react though, wouldn’t this need to go somewhere in the javascript settings?

Oh sorry I misunderstood

may be the mount path isn’t being picked up?

How do you deploy the app?

a war going to a tomcat

Then try the configuration

which one / which setting?

server.servlet.context-path=/demo

@adaptable-uakari but the issue is in the javascript?

I assume that the generator will take this property into account

Just try it

While this configuration will change the context-path you will most likely need to manage the context-path separately for file upload/download and probably links also. In a production setup it is most likely better to use some kind of web-server frontend and manage the context-path there.

Not with Hilla because you’ll get a single deployment.

I tested this with the vaadin-upload component and it required target=“/demo/upload” instead of simply using target=“/upload”

In that case, you would need to configure the context path in the client. A web server frontend will not help