iis的web.confg 中url重写与cros Configuring Inbound Rewrite Rules

最近有关注到web.config 配置,

有url 请求转发和跨域配置相关知识,

以下列出相关配置官网介绍:

Creating Rewrite Rules for the URL Rewrite Module | Microsoft Learn

<rewrite>
<rules>
<rule name="Fail bad requests">
<match url=".*"/>
<conditions>
<add input="{HTTP_HOST}" pattern="localhost" negate="true" />
</conditions>
<action type="AbortRequest" />
</rule>
<rule name="Redirect from blog">
<match url="^blog/([_0-9a-z-]+)/([0-9]+)" />
<action type="Redirect" url="article/{R:2}/{R:1}" redirectType="Found" />
</rule>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.aspx?id={R:1}&amp;title={R:2}" />
</rule>
</rules>
</rewrite>

 

 以下是配置跨域请求:

CORS Module Configuration Reference | Microsoft Learn

 

posted @   星辰与大海  阅读(53)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· Qt个人项目总结 —— MySQL数据库查询与断言
历史上的今天:
2020-03-10 C# 计时器-一种记录程序执行花费多长时间的监听程序
点击右上角即可分享
微信分享提示