redirect - 使用 IIS 重写的自定义域和资产重定向
问题描述
我正在尝试进行自定义域映射,其中我必须映射作为自定义域的 custom.seconddomain.com,并且我的应用程序托管在 app.firstdomain.com 上。
所以我为 seconddomain.com 添加了一个 CNAME 条目到域提供商。然后在我的托管 app.firstdomain.com 的服务器中为 custom.seconddomain.com 添加了一个 IIS 条目。我在此 IIS 条目中添加了一个重写规则,以便将应用程序路由重写到 app.firstdomain.com。到目前为止,一切都很好。
<rule name="Subdomain rewrite" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^((http)?(s)?:\/\/)?custom.seconddomain.com\/(.*)" />
</conditions>
<action type="Rewrite" url="http://app.firstdomain.com/" appendQueryString="true" />
</rule>
但现在由于资产和资源仅在 app.firstdomain.com 上可用,因此无法在 custom.seconddomain.com 上加载这些资产。因此,为此我在 IIS 重写规则上添加了一条规则,以将资产请求从 custom.seconddomain.com 重定向到 app.firstdomain.com,但不确定是由于规则的优先级还是其他原因。两条规则似乎不能一起运作。
<rule name="Rule 1">
<match url="^((http)?(s)?:\/\/)?custom.seconddomain.com\/assets\/(.*)" />
<conditions>
<add input="{HTTP_REFERER}" pattern="^$" negate="true" />
</conditions>
<action type="Rewrite" url="https://app.firstdomain.com/assets/{R:4}" />
</rule>
我是 IIS 新手,所以我也试图通过图像热链接来实现这一点,以尝试实现预期的结果。你能告诉我我在这里错过了什么或做错了吗?
解决方案
推荐阅读
- sql - 清理代码并防止空值崩溃 read.csv.sql
- c# - 从 Polar H10 (UWP) 获取心率变异性
- mysql - 在 docker-compose.yaml 中配置应用程序和 MySQL 数据库 - 无法打开 JDBC 连接
- flutter - 如何在 Flutter 中依次迭代 Map 的对象值,并在迭代时一一返回每个值?
- oracle - Oracle:如何删除与名称掩码匹配的程序
- javascript - 谷歌脚本简单搜索
- sql - 连接到 Excel SQL 连接的两个数据源
- qt - 打开 QML FileDialog 时,应用程序无限期挂起
- node.js - 为什么尽管有 conv.close,但助手仍然显示格式错误的响应?
- json - 解析reddit json链接以查找特定图片链接