RStudio can't access Package Manager URL but I can with a browser

Is this a Windows machine? We've seen similar errors before on Windows, specifically in corporate environments where a MITM proxy is being used: Workaround Found for "libcurl SSL errors on Windows"

There's an explanation of the issue here in the R manual, under Secure URLs: R: Download File from the Internet

On Windows with method = "libcurl", the CA root certificates are provided by the OS when R was linked with libcurl with Schannel enabled, which is the current default in Rtools. This can be verified by checking that libcurlVersion() returns a version string containing ‘⁠"Schannel"⁠’. If it does not, for verification to be on the environment variable CURL_CA_BUNDLE must be set to a path to a certificate bundle file, usually named ‘ca-bundle.crt’ or ‘curl-ca-bundle.crt’. (This is normally done automatically for a binary installation of R, which installs ‘R_HOME/etc/curl-ca-bundle.crt’ and sets CURL_CA_BUNDLE to point to it if that environment variable is not already set.) For an updated certificate bundle, see curl - SSL CA Certificates. Currently one can download a copy from https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt and set CURL_CA_BUNDLE to the full path to the downloaded file.

On Windows with method = "libcurl", when R was linked with libcurl with Schannel enabled, the connection fails if it cannot be established that the certificate has not been revoked. Some MITM proxies present particularly in corporate environments do not work with this behavior. It can be changed by setting environment variable R_LIBCURL_SSL_REVOKE_BEST_EFFORT to TRUE, with the consequence of reducing security.

One workaround would be to set the environment variable mentioned, R_LIBCURL_SSL_REVOKE_BEST_EFFORT to TRUE, with the drawback of reduced security.

Another option that might work is to change the default download method from libcurl to curl using options(download.file.method = "curl"). That would shell out to curl if available on the system, and might bypass the issue with R's version of libcurl.

1 Like