IIS8 - Slash after file name delivers file & HTTP:200 for CFM, HTML, but HTTP:404 for ASP

75 views Asked by At

I'm working on a site that's recently migrated to IIS8/Windows Server 2012 R2. It's running ColdFusion 11, and serves a mix of static HTML, CFM and ASP content.

The problem I'm facing is this:

For .cfm and .htm files, it is possible to enter a URL with a trailing slash (with or without arbitrary text after the slash) and still get the file served with a HTTP 200 OK response code. For example, all of these:

myurl.com/about.cfm/foo 
myurl.com/about.cfm/    
myurl.com/about.cfm/typewhateveryouwantitdoesnotmatter

will deliver the same content as

myurl.com/about.cfm

Except that any relative URLs in the page will break - images, CSS, scripts, links, etc. IIS interprets about.cfm/ as a directory, and returns the rendered content of the about.cfm file for any nonexistent "file" in that "directory".

This behavior is undesireable - I'd rather it produced a 404 error.

Interestingly, the misbehavior described above does not work for ASP content.

myurl.com/about.asp/foo

returns HTTP 404: Not Found just as one would want.

Googling this problem is tough because of the signal-to-noise ratio - I'm wading through reams of basic IIS URL rewrite advice concerning the addition of trailing slashes to directories, and having a hard time finding anything like my situation. Thanks in advance for your help!

0

There are 0 answers