You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

RStudio公司防火墙下HTTPS代理证书错误问题求助

Fixing HTTPS GET Requests Behind Corporate Firewall in RStudio

Hey there, I’ve dealt with exactly this kind of proxy headache behind corporate firewalls before—HTTP works fine, but HTTPS throws errors. Let’s break down the likely issues and how to fix them:

1. Double-Check Your HTTPS Proxy Address

First off, don’t assume your HTTP and HTTPS proxy details are identical. A lot of companies use different ports or even slightly different proxy URLs for HTTPS traffic.

  • Verify with your IT team: Confirm the exact HTTPS proxy URL, port, and credentials. Your current .Renviron has https_proxy="https://user:pw@proxy:port"—maybe the proxy uses http:// instead of https:// for the HTTPS proxy endpoint? Odd, but I’ve seen it happen.

2. Fix Proxy Authentication Format

Some corporate proxies don’t support embedding credentials directly in the proxy URL. Instead, use httr’s explicit proxy authentication:

library(httr)
# Replace with your actual proxy details
raw.result <- GET(
  url = "https://www.example.com/",
  use_proxy(
    url = "proxy", 
    port = your_port_number, 
    username = "your_user", 
    password = "your_pw"
  )
)

This avoids any parsing issues with the URL-embedded credentials.

3. Handle Corporate SSL Certificates

Corporate firewalls often intercept HTTPS traffic with self-signed or internal CA certificates, which curl (the underlying library for httr) doesn’t trust by default.

To rule out certificate issues, temporarily disable certificate verification (only do this for testing!):

handle <- handle("https://www.example.com/")
handle_setopt(handle, ssl_verifypeer = 0)
raw.result <- GET(handle = handle)

Proper Long-Term Fix

Get the corporate CA certificate file (ask IT for it) and point curl to it in your .Renviron:

CURL_CA_BUNDLE="/full/path/to/company_cacert.pem"

Restart RStudio after updating .Renviron for this to take effect.

4. Update Your curl/httr Versions

Outdated versions of curl or the httr package can cause compatibility issues with modern HTTPS standards. Run these commands to check and update:

# Check current versions
curl::curl_version()$version
packageVersion("httr")

# Update httr if needed
install.packages("httr")

If curl is outdated, you might need to update it system-wide (check with your IT team if you’re on a work machine).

Start with verifying the proxy address first—it’s the most common culprit. If that doesn’t work, move to the authentication and certificate checks.

内容的提问来源于stack exchange,提问作者PinkyL

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:26:17