You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When RStudio Server is behind a reverse proxy at a subpath (e.g., /rstudio/ via www-root-path), the Posit Assistant chat feature fails to connect its WebSocket. The buildWebSocketUrl() function in SessionChat.cpp does not prepend the root path to the port-mapped WebSocket URL.
Steps to Reproduce
Configure RStudio Server behind a reverse proxy at a subpath:
Set www-root-path=/rstudio in rserver.conf
Configure nginx (or similar) to proxy /rstudio/ to RStudio Server
Open RStudio at http://host/rstudio/
Open the Posit Assistant chat pane
Expected Behavior
The chat WebSocket connects to /rstudio/p/{hash}/ai-chat/ws and messages flow normally.
Actual Behavior
The chat WebSocket attempts to connect to /p/{hash}/ai-chat/ws (missing the /rstudio prefix), which causes:
The request bypasses the proxy's /rstudio/ location block (404 from nginx)
Even if /p/ is separately proxied, the port-token cookie is scoped to /rstudio/ so the browser doesn't send it (302 auth redirect from RStudio Server)
The chat pane loads the UI but the chat box remains disabled and icons below it don't appear.
Root Cause
buildWebSocketUrl() prepends the RS_SESSION_URL env var (for Workbench session prefixes like /s/{id}) but does not account for session-root-path. In open-source RStudio Server, RS_SESSION_URL is always empty, so the root path is never included.
Other port-mapped features (Shiny, Viewer, Plumber) are unaffected because they return relative URLs (e.g., p/08afc455/) that the browser resolves against the current page URL which already includes the subpath. The chat code differs by constructing an absolute path starting with /.
Environment
RStudio Server (open-source) behind nginx reverse proxy at /rstudio/
Activity
Prepend root path to chat WebSocket URL for subpath proxies
Fix chat WebSocket URL for subpath reverse proxy deployments (#17250)
ronblum commentedon Apr 14, 2026
Verified in RStudio Server 2026.04.0+515 on Ubuntu 24 via Firefox on Ubuntu 24.