ALL_PROXY Is a Fallback for R’s curl Requests
Set a complete proxy URL in the R process, then account for protocol-specific variables, bypass rules and explicit curl handle options.
R's curl package uses libcurl. A process environment proxy can therefore apply even when curl_fetch_memory has no proxy argument in the call:
Sys.setenv(ALL_PROXY = "http://proxy.example:8080")
result <- curl::curl_fetch_memory("https://www.example.org/")
Set the environment before preparing the request. Use a full endpoint, including the intended scheme and port, rather than assuming a bare hostname means the right protocol. For permitted public-site requests, the HTTP proxy list supplies candidates for the examples’ HTTP proxy URLs.
ALL_PROXY is a fallback. A proxy environment variable for the destination's protocol takes priority, and a matching NO_PROXY bypass can still select a direct connection. Inspect those values when changing ALL_PROXY appears to have no effect.
For a route that belongs to one handle, configure it explicitly:
handle <- curl::new_handle(proxy = "http://proxy.example:8080")
result <- curl::curl_fetch_memory(
"https://www.example.org/", handle = handle
)
The handle's proxy option overrides environment proxy selection; bypass policy remains relevant. An explicitly empty proxy option disables proxy use even when a proxy environment variable exists.
These settings affect the running R process and curl's requests. Starting a different R session or using a package with another networking implementation can produce a different route.