title: Serving .APK file from CDN with headers to install in Android
body: <p>I want to serve a <code>.APK</code> file to users to download. I have a <code>CDN</code> and it works fine. When I request file download, It downloads from <code>CDN</code>. But I have a problem. My users request downloads from <code>Android</code> devices, in this case, Downloading pure APK file goes trouble because I want to users install that <code>APK</code> file and with pure APK it's not possible as I know. So I create a <code>.php</code> file like this and add <code>'Content-Type: application/vnd.android.package-archive'</code>:</p>
  
  <pre><code>&lt;?php
  
  $file = 'myfile.apk'; //File that we want to send to user.
  
  if (file_exists($file)) {
      header('Content-Description: File Transfer');
      header('Content-Type: application/vnd.android.package-archive');
      header('Content-Disposition: attachment; filename='.basename($file));
      header('Content-Transfer-Encoding: binary');
      header('Expires: 0');
      header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
      header('Pragma: public');
      header('Content-Length: ' . filesize($file));
      ob_clean();
      flush();
      readfile($file);
      exit;
  }
  ?&gt;
  </code></pre>
  
  <p>When I request download.php, Its work and users can download and install the <code>APK</code> file. And now my question is, In this case, That file downloads from the CDN? I want both <code>download.php</code> and APK file served from CDN because I don't have enough traffic. </p>
  
  <p>Or is this possible to add <code>'Content-Type: application/vnd.android.package-archive'</code> to downloading file from <code>CDN</code> without php?</p>
  
  <p>PS: When i request pure APK file, Because it's from CDN, It downloads instantly like it's caching, But with download.php, It takes time to download. it means in this case it's not from CDN?</p>