gpt4 book ai didi

java - Azure 存储 Blob : https://(storageAccountName). blob.core.windows.net/vhd?restype=container&comp=list 无法使用代理工作

转载 作者:行者123 更新时间:2023-12-02 03:30:16 25 4
gpt4 key购买 nike

为了获取 blob 容器详细信息,我们使用下面提到的 REST API。Vhd 是 blob 容器名称。

https://(storageAccountName).blob.core.windows.net/vhd?restype=container&comp=list

当我们使用代理服务器详细信息(例如:SQUID 代理)访问存储 REST API 调用时,我们收到以下错误。

HttpResponse for Blobs:: ResourceNotFoundThe specified resource does not exist. RequestId:6dc7e6f2-0001-000d-30f9-d56eb3000xxx

如果我们在没有代理服务器的情况下访问相同的其余 api,我们将获得有效的响应并且它正在工作。

最佳答案

根据我的经验,通常情况下,使用squid作为后端服务的反向代理,但这里您希望通过squid作为正向代理来访问存储REST API。可以引用wiki页面https://en.wikipedia.org/wiki/Proxy_server ,SO线程Difference between proxy server and reverse proxy serverblog了解两者之间的差异。

所以问题的解决方案是将代理服务器配置为转发代理。

  1. 对于Squid,您可以尝试引用squid wiki页面http://wiki.squid-cache.org/SquidFaq/ConfiguringSquidhttp://wiki.squid-cache.org/Features/HTTPS了解如何使用 HTTPS 配置为前向代理。

  2. 对于 Apache,您可以尝试引用 apache 文档页面 http://httpd.apache.org/docs/2.0/mod/mod_proxy.html#forwardreverse要做的事。

然后,在成功设置转发代理后,设置 Java 的系统属性以启用代理支持。

有两种方式支持 Java 代理。

  1. 命令行 JVM 设置:代理设置通过命令行参数提供给 JVM:

    java -Dhttp.proxyHost=proxyhostURL -Dhttp.proxyPort=proxyPortNumber -Dhttp.proxyUser=someUserName -Dhttp.proxyPassword=somePassword HelloWorldClass
  2. 在代码中设置系统属性:在 Java 代码中添加以下行,以便 JVM 使用代理进行 HTTP 调用。

    System.setProperty("http.proxyPort", "someProxyPort");
    System.setProperty("http.proxyUser", "someUserName");
    System.setProperty("http.proxyPassword", "somePassword");
    System.setProperty("http.proxyHost", "someProxyURL");

有关 Java 中的网络、代理和属性的更多信息,请参阅 http://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.htmlhttp://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html .

关于java - Azure 存储 Blob : https://(storageAccountName). blob.core.windows.net/vhd?restype=container&comp=list 无法使用代理工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38194727/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com