【问题标题】:Allow traffic from a webjob in a staging slot in Azure允许来自 Azure 暂存槽中的 Web 作业的流量
【发布时间】:2016-03-14 22:47:54
【问题描述】:

我在 Azure 中使用了一个暂存槽,我只允许一些 IP 访问它。我在 web.config 文件中编写了以下规则:

<rule name="Block unauthorized traffic to staging sites" stopProcessing="true">
         <match url=".*" />
         <conditions>              
           <add input="{HTTP_HOST}" pattern="^mydomain\-mydomainslot1\."/>
           <!-- white listed IP addresses -->
           <add input="{REMOTE_ADDR}" pattern="ip1" negate="true"/>
           <add input="{REMOTE_ADDR}" pattern="ip2" negate="true"/>        
         </conditions>
         <action type="CustomResponse" statusCode="403" statusReason="Forbidden"
         statusDescription="Site is not accessible" />
       </rule>

插槽接受来自我的域 ip1 和 ip2 的流量。但是,我有一个网络作业(在插槽中),它使 PostAsJsonAsync 调用插槽 url,并且我收到一个禁止作为答案。我不知道 webjob 的 IP 地址(它应该与网站/插槽相同),但无论如何,我没有在规则中使用它的静态 IP 地址。我应该如何解决这个问题?是否有另一种方法可以在不保留 Azure 中的 IP 的情况下解决此问题?

【问题讨论】:

    标签: azure web-config azure-webjobs azure-deployment-slots


    【解决方案1】:

    好的,我想通了。无需预留IP。我刚刚将所有可能的出站 IP 添加到我的 web.config 中,它现在正在工作。我错过了入站和出站 IP 不同的事实。 webjob 与网站具有相同的虚拟 IP,但可以有多个出站 IP。 Those outbound IPs 在 Azure 门户中。

    【讨论】:

      猜你喜欢
      • 2022-01-02
      • 1970-01-01
      • 2018-02-16
      • 2020-11-14
      • 1970-01-01
      • 2022-06-28
      • 2021-05-13
      • 2018-04-27
      • 2020-06-03
      相关资源
      最近更新 更多