0

I have a PHP script to download a KML file from a file server. The download part works, but the file downloaded is an older version of the file stored on the file server.

I tried setting Cache-Control and Pragma headers, but still the older version of the file is delivered when downloading the file using the PHP URL. I tried this on multiple browsers and confirmed that the latest version of the KML file is located on the file server.

What am I missing?

EDIT: Even changing the filename in header('Content-Disposition.. does not change the filename of the downloaded file. I get the exact same old file on all 3 browsers I tried. It is starting to look like a web server configuration issue?

<?php
//Update the date in the filename with new releases

header('Content-Type: application/vnd.google-earth.kml+xml kml');
header('Content-Disposition: attachment; filename="KML Repository (2017-05-31).kml"');
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

readfile("KML Repository (2017-05-31).kml");
?>
Rynardt
  • 5,547
  • 7
  • 31
  • 43

1 Answers1

0

It seems like the issue is with our internal proxy server caching the file for some reason. Using a direct internet connection the updated file is downloaded. I wonder if there is a way to signal to a proxy server to allow a new version to be downloaded.

Rynardt
  • 5,547
  • 7
  • 31
  • 43