SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Download over ssl

    With this header:

    Code:
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Type: text/plain");
    header("Content-Disposition: attachment; filename=$filename");
    header("Expires: 0");
    I can download fine without ssl. But I cannot download with ssl (https://).

    What is the problem of this header with ssl?

  2. #2
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try adding one of these:
    Pragma: private
    Cache-Control: private


    this works for us:
    header('Pragma: private, no-cache');
    header("Cache-Control: no-store, no-cache, must-revalidate, private, post-check=0, pre-check=0");
    header("Content-type: text/csv");
    header('Content-Disposition: attachment; filename="campaigns.csv"');
    Adscend Media,
    CPA Affiliate Network
    Ask me about our content gateway for monetizing content!

  3. #3
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I will try this, but will it work for any content-type, octet/stream, text/plain etc.?

  4. #4
    SitePoint Member
    Join Date
    Apr 2009
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah it should. Just change the Content-type.
    I remember it took quite a while before we found the correct mix of headers to get it to work in both IE and FF over SSL...
    Adscend Media,
    CPA Affiliate Network
    Ask me about our content gateway for monetizing content!

  5. #5
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AdscendJeremy View Post
    Yeah it should. Just change the Content-type.
    I remember it took quite a while before we found the correct mix of headers to get it to work in both IE and FF over SSL...
    Thank you, I will trt it to work on both IE and FF without ssl and over ssl.
    This is difficult to find the correct mix of headers. Thank you for sharing it with me.

  6. #6
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Are these files sensitive? If they are not, may I suggest redirecting the user out of HTTPS. Encryption takes a lots of CPU time, use it only when you really need it.

    Even more so...encrypting/decrypting large files takes huge amount of CPU time!
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  7. #7
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AdscendJeremy View Post
    Yeah it should. Just change the Content-type.
    I remember it took quite a while before we found the correct mix of headers to get it to work in both IE and FF over SSL...
    AdscendJeremy, it works fine if I do save the file but I cannot open it locally by clicking "Open" button in download dialog box. Any advice?

  8. #8
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did change

    Code:
    header("Cache-Control: no-store, no-cache, must-revalidate, private, post-check=0, pre-check=0");
    To

    Code:
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    and I can use both save and open in dialog box with and without ssl. However it is working fine now, wanted to check it with you if this is safe to change cach-control to this one?

  9. #9
    SitePoint Addict nimasdj's Avatar
    Join Date
    Dec 2007
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I asked the same question on WHT but got no answer there and a helpful answer here. I had another question about 2co, no answer there and useful answer here. SitePoint is too much better than that useless WHT. I see WHT has no longer any reason for its existence on the net. SitePoint is on the rock.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •