本文介绍了Invoke-WebRequest 代理绕过的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在访问本地可访问的 URL 时绕过 Windows 中的默认代理?

默认情况下,Invoke-WebRequest powershell cmdlet 使用默认代理服务器.在我的设置中,代理只允许某些 URL,本地可访问的 URL 不在该列表中.

By default the Invoke-WebRequest powershell cmdlet is using the default proxy server. In my setup the proxy allows only certain URLs and the locally accessible URL is not in that list.

有没有办法绕过代理?我可以将 URL 添加到代理允许列表中,但我不想这样做.

Is there a way to bypass the proxy? I can add the URL to the proxy allowed list but I don't want to do that.

感谢关注.

推荐答案

您可以通过编程绕过本地地址的代理,甚至在完成后返回旧的绕过列表.

You can programmatically bypass proxy for local addresses and even return the old bypass list after you are done.

我的函数 proxy 会让你做那.添加您的域或服务器名称或其 IP 地址以覆盖列表:

My function proxy will let you do that. Add your domain or server name or its IP address to override list:

   $p = proxy
   $p.Override += "*.domain.com"
   $p | proxy
   Invoke-WebRequest ...
   #you could return old override here.

否则,我认为这应该可行:

Otherwise, I think this should work:

 $proxy = new-object System.Net.WebProxy
 Invoke-WebRequest -Proxy $proxy ...

这篇关于Invoke-WebRequest 代理绕过的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 12:49