Back

rails - 让对应的进程使用代理 use http proxy in rails app

发布时间: 2023-06-01 07:19:00

refer to: https://stackoverflow.com/questions/15792999/how-to-set-a-proxy-in-rubys-net-http

在terminal中,直接设置 http_proxy 变量就可以。(export HTTP_PROXY=...)

在rails中也一样。

1. export http_proxy=xx

2. rails s

这样,进入到rails console中,就可以看到 ENV['http_proxy'] 这个值了。

然后就可以直接在 rails中:

HTTParty.get "google.com"了。

Back