Hilla context path

What is the preferred way to set the context path in a Hilla + Spring Boot project? server.servlet.context-path or vaadin.urlMapping? Are there perhaps other alternatives?

(copied from Vaadin office hours)

This depends.

I use vaadin.urlMapping when I have to use “problematic” tools like Swagger UI or Camunda worflow engine

Other than that I never change the context path because most applications run behind a proxy

and if the path has to be changed the proxy will do that

Copying @original-uguisu’s reply here as well

Spring’s context path setting is more semantically correct if you want to put the whole deployment on a sub path, whereas the Vaadin URL mapping is for cases when you want to have other parts of the application in the root and the Vaadin part on a sub path.

In practice, one of the biggest differences is with how static resources (e.g. src/main/resources) are handled. The follow the context path setting but ignore the URL mapping

That’s correct. I simply can’t think of a reason why to set the context path

I’m personally matching reverse proxy path like /web with the context path /web of my app

I start the apps as executable JARs so the app has a dedicated port. And then the apps have a subdomain that routes to the port

Subdomains, I miss those magical unicorns… I had people saving on certificate costs and only buying www. and non-www SSL certs :sweat_smile: there was no room for costly wildcard or more subdomain certs.

But even if you are using paths you can map those to the port without changing the context path

True! I just prefer it matching… I’ve see Problems with applications in the past that I don’t wanna see again where it wasn’t aligned

I know what you mean. I’m happy to use Traefik and not one of the old reverse proxies