Download pdf over SSL

168 views
Skip to first unread message

Steven Rigney

unread,
Jan 27, 2011, 10:29:32 AM1/27/11
to play-framework
I have a site that has to run over SSL. One of the pages has a link
to download a pdf file. When I click this link I get an error that
Internet Explorer cannot download the file.

I found this problem document in a Knowledge Base article at
Microsoft. http://support.microsoft.com/kb/316431

I have been playing for a day trying to get the Pragma No-Cache header
removed from the header. I can't find anywhere that it is actually
being set, even when digging through the Play framework, but when I
run Fiddler I can see the headers that are being returned and this is
included.

How can I get the Play Framework to remove the Pragma No-Cache
header?

Steven Rigney

unread,
Jan 27, 2011, 1:43:49 PM1/27/11
to play-framework
I want to make sure I state this correctly. I found in Fiddler that I
was looking at the previous page and not at the actual download of the
pdf file.

The header when downloading the pdf does not have have the Pragma No-
Cache, it does have Cache-Control: no-cache="set-cookie"

I need to be able to not have the Cache-Control header included in
order to download the pdf file.

Steven Rigney

unread,
Jan 27, 2011, 3:30:26 PM1/27/11
to play-framework
I'm not sure exactly which fix worked yet, but I am working again. I
hacked the Play framework to remove the no-cache header. However
after I did that I was still having it show up. I found that WAS adds
no-cache when adding cookies. I had to change a Websphere
configuration value to prevent the cookies from adding the no-cache
value. That allowed it to work.

cyrille

unread,
Jul 4, 2012, 5:09:18 AM7/4/12
to play-fr...@googlegroups.com
Hi,

I'm having exact the same issue. I have this setup:
Play 1.2.4 as war in tomcat7 and apache2 ajp-proxy in front of it.

Can anybody help me with this issue?

All help appreciated!

Thanks in advance,
Cyrille

Sebastien Cesbron

unread,
Jul 4, 2012, 6:42:03 AM7/4/12
to play-fr...@googlegroups.com
Hi

In the pdf module, there is some liines to handle this :

            // FIX IE bug when using SSL
            if(request.secure && isIE(request))
                response.setHeader("Cache-Control", "");



    private boolean isIE(Request request) {
        if(!request.headers.containsKey("user-agent"))
            return false;
       
        Header userAgent = request.headers.get("user-agent");
        return userAgent.value().contains("MSIE");
    }

You may try to do the same for your pdf.

Regards
Seb

2012/7/4 cyrille <c.bart...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/PlCitDjJT-EJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

cyrille

unread,
Jul 4, 2012, 11:00:51 AM7/4/12
to play-fr...@googlegroups.com
Hi,

Implemented your solution and it works.
Made one adjustment. According to this site

response.setHeader("Cache-Control", "no-store, no-cache");


should work also. Removing "no-store" or reversing the order, downloading will fail again.
Tested it and: BINGO!

Thanks for your help.

Regards,
Cyrille



On Wednesday, July 4, 2012 12:42:03 PM UTC+2, Seb wrote:
Hi

In the pdf module, there is some liines to handle this :

            // FIX IE bug when using SSL
            if(request.secure && isIE(request))
                response.setHeader("Cache-Control", "");



    private boolean isIE(Request request) {
        if(!request.headers.containsKey("user-agent"))
            return false;
       
        Header userAgent = request.headers.get("user-agent");
        return userAgent.value().contains("MSIE");
    }

You may try to do the same for your pdf.

Regards
Seb

Reply all
Reply to author
Forward
0 new messages