gpt4 book ai didi

asp.net - 通过域名限制对网站的访问

转载 作者:行者123 更新时间:2023-12-02 21:29:35 26 4
gpt4 key购买 nike

我正在私下测试一个与其他 API 通信的 Azure Web 应用程序。我只允许某些 IP 地址通过,如下所示:

<system.webServer>
<security>
<ipSecurity>
<add allowed="true" ipAddress="192.168.100.1" subnetMask="255.255.255.0" />
</ipSecurity>
</security>

但是,一个 API 没有可靠的静态 IP 地址。所以我试图通过域让它通过,如下所示:

https://www.iis.net/configreference/system.webserver/security/ipsecurity/add

<system.webServer>
<security>
<ipSecurity>
<add allowed="true" domainName="example.com." />
</ipSecurity>
</security>

文档说:“指定要对其施加限制规则的域名。您可以使用星号 (*) 作为通配符。”

我认为我的域名错误(此时只是猜测,需要查看日志),因为它不起作用。我尝试过“*.example.com”、“example.com”和“example.com”。 (末尾有点)。

这让我问:

1) 该域名字符串必须采用什么格式?我找不到任何例子。例如,它需要协议(protocol)“https”还是“http”?

2) 如何查看尝试连接到 Azure Web 应用程序的域名/IP 地址?换句话说,我如何查看相当于 fiddler 的流量?我需要验证与我的网站通信的 API 端点。

最佳答案

1) 根据日志分析,我获得了 IP 地址,然后使用在线工具将其转换为域名,我需要允许通过的域的形式如下:

subsubdomain.subdomain.example.com。

由于负载平衡,我不能只允许一个域通过。我被迫使用这个字符串,它有效:

*.subdomain.example.com

2) 我找到了相关的 IP 地址,然后使用 Kudu Web 界面将其转换为域(使用在线工具)。首先,我单击“调试控制台”,它显示文件结构,然后单击“LogFiles”,然后单击“http”,然后单击“RawLogs”。我下载了日志并在 Excel 中查看了它们。

关于asp.net - 通过域名限制对网站的访问,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38539739/

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