U4-6505 - 404 Page Doesn't Work For Pages with Some Extensions When URL Rewriting

Created by Nicholas Westby 06 Apr 2015, 23:42:00 Updated by Nicholas Westby 24 Feb 2017, 23:26:36

Relates to: U4-9567

I have a site with a single 404 page (nothing fancy). The site has support for internationalization, so I use a URL rewrite rule to allow for URL's like "/en-us/page" (that is rewritten as "/page?lang=en-us"). Problem is, my 404 page doesn't work for pages with certain extensions, such as:

  • /en-us/page.html (I get a blank white page with a 404 HTTP header)
  • /en-us/something.abc (I get a blank white page with a 404 HTTP header)
  • /en-us/image.gif (I get an ugly 404 with a 404 HTTP header): !ugly-404.png!

Works fine for pages with a ".aspx" extension (though, my site uses extensionless pages without a trailing slash). There reason this is important is that this site replaces a legacy site with other types of extensions than found on the new site. Here are examples of pages that serve the correct 404 page:

  • /en-us/something
  • /en-us/something.aspx
  • /en-us/something/

Some information about my setup and other observations:

  • My "Home" node is under another node at the root. The "Home" node is the one domain set via the "Culture and Hostnames" dialog.
  • My UrlRewriting.config looks like this: !rewrite.png!
  • I set a breakpoint in my page not found template, and it gets hit for "/en-us/page.html", but a white page is still rendered.
  • My web.config has this configured (I forget why I did this, but it seemed necessary at the time... see [https://our.umbraco.org/forum/ourumb-dev-forum/bugs/50332-Custom-404-Only-Works-for-Extensionless-and-ASPX-URLs this old thread] for more details): !web.png!
  • My umbracoSettings.config has the 404 page configured like this: !settings.png!
  • My umbracoSettings.config has trySkipIisCustomErrors set to true.
  • I thought my issue might have to do with the lang in the query string, so I modified the rewrite rule to use a different query string parameter... didn't help.

IIS 8.5 (I also see similar results when running from Visual Studio). Umbraco 7.2.4 (upgraded from 7.2.2, which was upgraded from 7.1.8). Can't remember if it applied to 7.1.8, but definitely applies to 7.2.2 and 7.2.4.

4 Attachments


Nicholas Westby 24 Feb 2017, 23:26:36

I suspect the cause of this is the IsClientSideRequest function here: https://github.com/umbraco/Umbraco-CMS/blob/5397f2c53acbdeb0805e1fe39fda938f571d295a/src/Umbraco.Core/UriExtensions.cs#L143

Some background: http://issues.umbraco.org/issue/U4-9567

TLDR: That function prevents Umbraco from processing requests when the URL has an extension that isn't in a hardcoded whitelist.

Priority: Normal

Type: Bug

State: Submitted


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.2.2, 7.2.4

Due in version:


Story Points: