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
{{ message }}
Repository navigation
RStudio proxy attempts to proxy localhost through http_proxy #19100
RStudio Edition : Server
RStudio Version : rstudio-server-rhel-2026.09.0-174
OS Version : RHEL 9.8
R Version : 4.6
Steps to reproduce the problem
Run RStudio-Server with http_proxy set and attempt to start Posit AI Assistant
Refused to connect to Posit AI Assistant error will pop up
Network connections show 403 error - websocket connection refused
Describe the problem in detail
I am running RStudio-Server on a host with a http_proxy
I enabled Posit AI Assistant but was unable to connect with error 403
Turns out that RStudio-Server will attempt to proxy the localhost over the environment http_proxy which fails
No errors are logged anywhere except clientside
This is fixable by setting no_proxy='localhost' but this fix is difficult to find
Describe the behavior you expected
I expected localhost/127.0.0.1 to not be proxied over http proxy or some documentation about this
Thanks for the report, @hsmallbone. This is a bug: rserver applies http_proxy to its own connections to localhost, and it can't reach the RStudio server's localhost through a remote proxy. It isn't specific to Posit Assistant; anything RStudio Server proxies to a local port is affected (Shiny apps, Quarto previews, and so on). It's also a documentation gap, because the open-source docs never say that localhost needs to be listed in no_proxy.
Workaround: add the local addresses to no_proxy wherever you set http_proxy, for example in /etc/rstudio/env-vars:
Keep any other entries you already have in no_proxy, then restart RStudio Server (sudo rstudio-server restart), since the proxy settings are only read at startup.
For more detail, see Outgoing Proxies in the Posit Workbench admin guide. It's written for Workbench, but the env-vars and no_proxy sections apply to RStudio Server as well; the Workbench-only features it lists and the Launcher note don't.
We'll follow up with a fix so local connections never go through the proxy.
Root cause.TcpIpAsyncClient::connectAndWriteRequest (src/cpp/core/include/core/http/TcpIpAsyncClient.hpp:92) calls proxyUtils().httpProxyUrl(address_, port_) and connects to the proxy whenever that returns a URL. The SSL client does the same with httpsProxyUrl (TcpIpAsyncClientSsl.hpp:90). ProxyUtils::shouldProxy (src/cpp/core/http/ProxyUtils.cpp:86) exempts a destination only when a no_proxy rule matches it. Nothing exempts loopback by default. This was introduced in 8ed7b75 (rstudio-pro#5893) and first released in v2024.12.0.
Affected paths:
Open source: rserver's /p/ and /p6/ handler, proxyLocalhostRequest in src/cpp/server/session/ServerSessionProxy.cpp, connects with a LocalhostAsyncClient to "localhost" (:1523) or "::1" (:1527). Posit Assistant's WebSocket uses /p/ in server mode (buildWebSocketUrl in SessionChat.cpp), and so does anything else served through a port-mapped URL.
rstudio-pro, Launcher sessions: the session proxy in rsession (src/cpp/session/http/SessionProxy.cpp) connects to "localhost" the same way. Launcher jobs inherit rserver's proxy variables through forwardHttpProxyVars().
Symptom since 2026.08.0. The port-ownership check from #18330 runs against the proxy's address and port instead of the local app's, so it fails. handleLocalhostError then returns a 403, "Not authorized to access the requested port". LocalhostAsyncClient.hpp:76 logs Refusing localhost proxy to port <N> at WARN, where <N> is the proxy's port. The request never reaches the proxy.
Fix. Make ProxyUtils::shouldProxy return false for loopback destinations, whatever no_proxy says:
the hostname localhost, case-insensitive;
any IPv4 address in 127.0.0.0/8;
::1.
For IP literals, parse with boost::asio::ip::make_address and check is_loopback(); don't match strings. Make the exemption by destination address, not by client class. In rstudio-pro, LocalhostAsyncClient(Ssl) also connects to remote hosts: the rserver-to-session-host hop in ServerSessionProxyOverlay.cpp and ServerAgentsViewProxy.cpp. Admins' no_proxy settings must keep controlling those.
Remove the now-redundant rules. The 127.0.0.1:<port> no-proxy rules added in desktop and standalone mode (src/cpp/session/SessionMain.cpp:2780 and :2797) become dead code once loopback is always exempt. Remove them. Check whether addNoProxyRule and createNoProxyRule(address, port) have other callers before deleting them.
Tests. Add tests to src/cpp/core/http/ProxyUtilsTests.cpp, following the existing pattern (set the env vars, then construct ProxyUtils directly). With http_proxy and https_proxy set and no no_proxy:
httpProxyUrl and httpsProxyUrl return none for localhost, LOCALHOST, 127.0.0.1, 127.1.2.3 and ::1;
they still return the proxy for a non-loopback host and IP, such as example.com and 10.0.0.1;
an existing no_proxy rule for a non-loopback host still applies.
Run them with ./build/src/cpp/rstudio-tests --scope core.
NEWS. Add a ### Fixed entry linking #19100. Released users have been affected since 2024.12.
Out of scope:
The ownership-check warning reports the proxy's port as <N>. That's worth fixing separately.
The Workbench docs (docs/server/admin/access_and_security/outgoing_proxies.qmd in rstudio-pro) say to add localhost to no_proxy. That advice becomes unnecessary but stays harmless, so updating it can follow the downstream merge.
Activity
gtritchie commentedon Oct 14, 2026
Thanks for the report, @hsmallbone. This is a bug: rserver applies
http_proxyto its own connections tolocalhost, and it can't reach the RStudio server's localhost through a remote proxy. It isn't specific to Posit Assistant; anything RStudio Server proxies to a local port is affected (Shiny apps, Quarto previews, and so on). It's also a documentation gap, because the open-source docs never say thatlocalhostneeds to be listed inno_proxy.Workaround: add the local addresses to
no_proxywherever you sethttp_proxy, for example in/etc/rstudio/env-vars:Keep any other entries you already have in
no_proxy, then restart RStudio Server (sudo rstudio-server restart), since the proxy settings are only read at startup.For more detail, see Outgoing Proxies in the Posit Workbench admin guide. It's written for Workbench, but the
env-varsandno_proxysections apply to RStudio Server as well; the Workbench-only features it lists and the Launcher note don't.We'll follow up with a fix so local connections never go through the proxy.
gtritchie commentedon Oct 14, 2026
Notes for the fix
Line numbers are from
mainat a1ea17e.Root cause.
TcpIpAsyncClient::connectAndWriteRequest(src/cpp/core/include/core/http/TcpIpAsyncClient.hpp:92) callsproxyUtils().httpProxyUrl(address_, port_)and connects to the proxy whenever that returns a URL. The SSL client does the same withhttpsProxyUrl(TcpIpAsyncClientSsl.hpp:90).ProxyUtils::shouldProxy(src/cpp/core/http/ProxyUtils.cpp:86) exempts a destination only when ano_proxyrule matches it. Nothing exempts loopback by default. This was introduced in 8ed7b75 (rstudio-pro#5893) and first released in v2024.12.0.Affected paths:
/p/and/p6/handler,proxyLocalhostRequestinsrc/cpp/server/session/ServerSessionProxy.cpp, connects with aLocalhostAsyncClientto"localhost"(:1523) or"::1"(:1527). Posit Assistant's WebSocket uses/p/in server mode (buildWebSocketUrlinSessionChat.cpp), and so does anything else served through a port-mapped URL.src/cpp/session/http/SessionProxy.cpp) connects to"localhost"the same way. Launcher jobs inherit rserver's proxy variables throughforwardHttpProxyVars().Symptom since 2026.08.0. The port-ownership check from #18330 runs against the proxy's address and port instead of the local app's, so it fails.
handleLocalhostErrorthen returns a 403, "Not authorized to access the requested port".LocalhostAsyncClient.hpp:76logsRefusing localhost proxy to port <N>at WARN, where<N>is the proxy's port. The request never reaches the proxy.Fix. Make
ProxyUtils::shouldProxyreturn false for loopback destinations, whateverno_proxysays:localhost, case-insensitive;::1.For IP literals, parse with
boost::asio::ip::make_addressand checkis_loopback(); don't match strings. Make the exemption by destination address, not by client class. In rstudio-pro,LocalhostAsyncClient(Ssl)also connects to remote hosts: the rserver-to-session-host hop inServerSessionProxyOverlay.cppandServerAgentsViewProxy.cpp. Admins'no_proxysettings must keep controlling those.Remove the now-redundant rules. The
127.0.0.1:<port>no-proxy rules added in desktop and standalone mode (src/cpp/session/SessionMain.cpp:2780and:2797) become dead code once loopback is always exempt. Remove them. Check whetheraddNoProxyRuleandcreateNoProxyRule(address, port)have other callers before deleting them.Tests. Add tests to
src/cpp/core/http/ProxyUtilsTests.cpp, following the existing pattern (set the env vars, then constructProxyUtilsdirectly). Withhttp_proxyandhttps_proxyset and nono_proxy:httpProxyUrlandhttpsProxyUrlreturn none forlocalhost,LOCALHOST,127.0.0.1,127.1.2.3and::1;example.comand10.0.0.1;no_proxyrule for a non-loopback host still applies.Run them with
./build/src/cpp/rstudio-tests --scope core.NEWS. Add a
### Fixedentry linking #19100. Released users have been affected since 2024.12.Out of scope:
<N>. That's worth fixing separately.docs/server/admin/access_and_security/outgoing_proxies.qmdin rstudio-pro) say to addlocalhosttono_proxy. That advice becomes unnecessary but stays harmless, so updating it can follow the downstream merge.gtritchie commentedon Oct 27, 2026
Note: fits under this Epic: https://github.com/rstudio/rstudio-pro/issues/8913.