tracker issue : CF-4197947

select a category, or use search below
(searches all categories and all time range)
Title:

<cfcontent> fails to serve PDF files when using IIS rewrite

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Dave Levin / Dave Levin (Dave Levin)

Created: 11/18/2016

Components: Web Container (Tomcat)

Versions: 2016

Failure Type: Data Corruption

Found In Build/Fixed In Build: CF2016_Update3 / NA

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Windows 10 64 bit

Vote Count: 1

Problem Description:

When serving a PDF document through <cfcontent> and IIS url rewrite the document will be incomplete (thus corrupt). The HTTP response headers that are returned show the wrong content-length as well as "connection: close".

This bug is similar to an already fixed bug in ColdFusion version 10:
https://bugbase.adobe.com/index.cfm?event=bug&id=3850990

There has been discussion on this issue in detail in the Adobe forums:
https://forums.adobe.com/message/9147251

Steps to reproduce:
1. Create a test environment where you will try and download a PDF file through <cfcontent> 
    e.g. <cfcontent type="application/unknown" file="[path to your file]" deletefile="No">

2. Create a page that will try and download your file based on an ID:
    e.g: /test/file.cfm?filesID=1

3. Create an IIS rewrite rule to point to the page you created in step 2.
    e.g. /test/file/1/  (should point to /test/file.cfm?filesID=1)

4. Try and download the file.

Actual Result:
When downloading the file through the direct URL (/test/file.cfm?filesID=1) your file will download normally.
When downloading the file through the IIS rewritten URL you will only download a 1KB file which is a corrupted version of the original PDF.

You'll note that the HTTP response headers will be different:

Here is an example of the proper response header when accessing a file (e.g. /test/file.cfm?filesID=1)
Cache-Control:no-cache, no-store, must-revalidate, max-age=0
Content-Disposition:attachment; filename="xxxxx"
Content-Length:207349
Content-Type:application/unknown;charset=UTF-8
Date:Fri, 18 Nov 2016 01:16:02 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache
Server:Microsoft-IIS/10.0
X-Powered-By:ASP.NET
 
Here's an example of the invalid response header when accessing a file via IIS rewrite (e.g. /test/file/1/ )
Cache-Control:no-cache, no-store, must-revalidate, max-age=0
Connection:close
Content-Disposition:attachment; filename="xxxxx"
Content-Length:1284
Content-Type:application/unknown;charset=UTF-8
Date:Fri, 18 Nov 2016 01:16:39 GMT
Expires:Thu, 01 Jan 1970 00:00:00 GMT
Pragma:no-cache
Server:Microsoft-IIS/10.0
X-Powered-By:ASP.NET

Note that with IIS rewrite enabled the addition of "connection: closed" and the incorrect content-length.

I believe that this is a problem with the connector and not the IIS rewrite module.

Any Workarounds:
Disable IIS rewrite for PDF files served via <cfcontent>

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4197947

External Customer Info:
External Company:  
External Customer Name: Dave Levin
External Customer Email:  
External Test Config: My Hardware and Environment details:

ColdFusion 2016 (update 3)

Windows 10 x64

Windows Server 2012

Attachments:

Comments: