proxy代理设置总结

由于各种墙的存在, 我们不得不学会设置代理, 这里总结下不同软件设置代理的方法.

curl

curl -x 127.0.0.1:8080 abc.zip

git

git config --local http.proxy 127.0.0.1:8899
git config --local https.proxy 127.0.0.1:8899

系统(适用apt-get)

export _proxy='http://127.0.0.1:8889'
export s_proxy='https://127.0.0.1:8889'
export HTTP_PROXY=$_proxy
export HTTPS_PROXY=$s_proxy
export FTP_PROXY=$proxy
export NO_PROXY="localhost,127.0.0.1,::1,10.0.0.0/8"
echo 'set HTTP_PROXY and HTTPS_PROXY'

还有一种方法是修改/etc/apt/apt.conf

Acquire::http::proxy "http://127.0.0.1:8080";
Acquire::ftp::proxy "http://127.0.0.1:8080";
Acquire::https::proxy "http://127.0.0.1:8080";

docker中git设置代理

这里172.17.0.1是docker的ip地址.

RUN git config --global https.proxy "https://172.17.0.1:8889" && git config --global http.proxy "http://172.17.0.1:8889"

pip

pip install --proxy=http://127.0.0.1:8080 -i https://pypi.tuna.tsinghua.edg.cn/simple you_package
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Vue项目中,可以使用proxy代理来解决跨域问题。在项目的配置文件中,可以通过配置proxyTable来设置代理。具体的配置步骤如下: 1. 打开项目的配置文件,一般是在config文件夹下的index.js文件。 2. 在index.js文件中找到proxyTable的配置项。 3. 在proxyTable中添加一个代理配置,比如'/api'。 4. 在代理配置中,设置target为接口的域名或IP地址,比如'127.0.0.1'。 5. 设置changeOrigin为true,表示允许跨域。 6. 可选地,可以使用pathRewrite来重写请求路径,比如将'/api'重写为空字符串。 7. 保存配置文件。 这样,在本地运行项目时,请求接口数据就不会出现跨域警告了。代理会将请求转发到指定的接口地址,并将响应返回给前端。 另外,还可以在url.js文件中设置域名部分的公共部分,然后在vue.config.js文件中进行代理配置。在vue.config.js文件中,可以使用proxy配置项来设置代理。比如,可以将'/api'代理到需要代理的API地址,并使用pathRewrite将'/api'重写为'/'。 总结起来,使用proxy代理可以解决Vue项目中的跨域问题,具体的配置步骤包括在配置文件中设置proxyTable或proxy配置项,并设置target、changeOrigin和pathRewrite等参数。这样就可以在本地请求接口数据而不出现跨域警告了。 #### 引用[.reference_title] - *1* *2* [Vue中的proxy代理](https://blog.csdn.net/qq_37190789/article/details/104391690)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [vue中的代理proxy](https://blog.csdn.net/qq_38829069/article/details/110497115)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值