简体   繁体   中英

URL rewrite outbound rules and custom error pages

I'm using Application Request Routing to proxy a blog into a larger website. I'm using the following rules to rewrite the URI-based attributes on HTML elements to ensure the generated HTML conforms to the proxy configuration:

<rule name="HtmlContentRewrite" preCondition="HtmlContent" stopProcessing="false">
    <match filterByTags="A, Area, Base, Form, Frame, Head, IFrame, Img, Input, Link, Script" pattern="^/([^/].*)" />
    <conditions logicalGrouping="MatchAll" trackAllCaptures="true" />
    <action type="Rewrite" value="/blog/{R:1}" />
</rule>

Now this works perfectly fine for all content, with the exception of custom error pages. The custom error pages are basicaly MVC views at /e/not-found, etc., but the rewriter isn't performing it's work on custom error pages, so my content is left unstyled and without images where it is failing to load those resources.

Does anyone know if URL rewriting outbound rules can actually be applied to custom error pages? If not, any suggested workaround?

另一种选择是将自定义错误页面存入重定向到普通URL的重定向,以允许进行URL重写。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM