Vaadin Push endpoint origin validation configuration for multi‑tenant deployments
0 reputation · 25 Jan 2022, 12:52 UTC
0 reputation · 25 Jan 2022, 12:52 UTC
Enable per‑session origin whitelisting for Vaadin Push WebSocket connections so that a single server can safely serve Push to multiple hostnames in a multi‑tenant environment.
Vaadin Push currently relies on the browser same‑origin policy and validates the TLS certificate only against the server hostname; there is no documented API or server‑side configuration to inject custom origin checks per UI session.
35275 reputation · 25 Jan 2022, 15:34 UTC
Vaadin does not provide a built‑in per‑session origin whitelist for Push WebSocket connections. The framework relies on the browser same‑origin check and validates the TLS certificate against the server hostname only.
setAllowedOrigins method existed on PushServlet, but it applies to all sessions and was deprecated/removed in later versions.server.address in Spring Boot, Tomcat Connector bindAddress, Jetty host), not a Vaadin setting.setAllowedOrigins via a servlet init parameter or by extending PushServlet; this will allow a static list of origins but not per‑session.javax.websocket.server.ServerEndpointConfig.Configurator or a Filter that checks the Origin header and calls HttpServletResponse#sendError(403) before the handshake completes.WebSocketHandler or use a Handler that inspects the request.Origin header against a per‑tenant map, returning 403 for disallowed origins. The proxy must forward the original Origin header unchanged.server.address=10.0.0.5 in Spring Boot) and ensure all tenant DNS names resolve to that address. This does not provide origin isolation but reduces the attack surface.To decide whether the deprecated global setAllowedOrigins can satisfy your needs, please confirm the exact Vaadin version you are running.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.