Forum

Thread tagged as: Question, Problem

Force Download files

I have two sites on two different servers: (download link is to the right in the orange bar) The first: https://timrackham.co.uk/gochatter/video.php This site works with .htaccess to force a download.

The second site: https://gochattervideos.com/video/post.php?s=are-you-ready-for-christmas login: email: smart@smar.com password: smart This site planned to work with .htaccess to force a download but it won't work and the only different thing is PERCH is running.

any idea if perch is causing a problem ?

Timothy Rackham

Timothy Rackham 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

If you compare the headers, the servers are configured to respond differently for that type of file:

$ curl -I https://timrackham.co.uk/gochatter/videos/test.mp4
HTTP/1.1 200 OK
Date: Thu, 27 Oct 2016 12:57:13 GMT
Server: Apache/2.4.18 (Unix) OpenSSL/1.0.1e-fips mod_bwlimited/1.4
Last-Modified: Mon, 05 Sep 2016 11:33:35 GMT
ETag: "82e481-18407f6-53bc10ceae1c0"
Accept-Ranges: bytes
Content-Length: 25430006
Content-Disposition: attachment
Content-Type: application/octet-stream

and

$ curl -I https://gochattervideos.com/perch/resources/are-you-ready-for-christmas-1.mp4
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 27 Oct 2016 12:58:35 GMT
Content-Type: video/mp4
Content-Length: 16158470
Last-Modified: Tue, 25 Oct 2016 17:26:03 GMT
Connection: keep-alive
Keep-Alive: timeout=60
ETag: "580f95ab-f68f06"
Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Accept-Ranges: bytes

The browser will download application/octet-stream because it doesn't know how to display it. It will play video/mp4 because it's a known type.