OS: centos 8
Java Version: 11.0.4 (AdoptOpenJDK) 64bit
Tomcat Version: Apache Tomcat/9.0.24
Lucee Version: Lucee 5.3.3.62
I’m trying to solve a problem with a PDF download. The problem occurs only in Firefox - Android.
Desktop + Chrome Android works fine.
The file is downloaded but if I click Open … Firefox says “this file cannot be opened.”
Im delivering a pdf document with cfcontent (“/a.cfm”).
When I dowload the same file direct from the webserver (“/aa.pdf”) everything works as expected.
My assumption is there is something with the http header while download, that something prevents Firefox from open the file.
The Code im using: (a.cfm)
<cfheader name="Content-Disposition" value="attachment;filename=""aa.pdf"";">
<cfheader name="Content-Length" value="100569">
<cfheader name="Content-Type" value="application/pdf">
<cfcontent type="application/pdf" file="#fn#" deletefile="no" reset="yes">
</cfcontent>
I tried some things with content type, added content-length , removing Composition …
I debugged the Request with wget:
The ony difference I found is the content Type:
Lucee: Content-Type: application/pdf;charset=UTF-8
Direct: Content-Type: application/pdf
- Did someone experimence something similar?
- Someone has a hint how to change the content type with lucee witout the “;charset=UTF-8” (wich I assume is the Problem for Firefox)?
- Someone has another idea why firefox dosent like the PDF Download?
Complete Request:
Per direct httpd:
---request begin---
GET /aa.pdf HTTP/1.1
User-Agent: Wget/1.19.5 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: devsite.lan
Connection: Keep-Alive
---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200 OK
Server: nginx/1.14.1
Date: Mon, 01 Feb 2021 23:20:59 GMT
Content-Type: application/pdf
Content-Length: 100569
Last-Modified: Fri, 18 Oct 2019 22:11:10 GMT
ETag: "5daa387e-33d0"
Strict-Transport-Security: max-age=63072000
Accept-Ranges: bytes
Per Lucee:
---request begin---
GET /aa.cfm HTTP/1.1
User-Agent: Wget/1.19.5 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: devsite.lan
Connection: Keep-Alive
---request end---
HTTP request sent, awaiting response...
---response begin---
HTTP/1.1 200
Server: nginx/1.14.1
Date: Mon, 01 Feb 2021 23:44:54 GMT
Content-Type: application/pdf;charset=UTF-8
Content-Length: 100569
Connection: keep-alive
Set-Cookie: cfid=ecc15606-c88e-4978-be44-10e3671ccd8e;Path=/;Expires=Mon, 22-Feb-2021 01:22:58 UTC;HTTPOnly
Set-Cookie: cftoken=0;Path=/;Expires=Mon, 22-Feb-2021 01:22:58 UTC;HTTPOnly
Content-Disposition: attachment;filename="aa.pdf";
Content-Language: de-CH
Strict-Transport-Security: max-age=63072000