Refresh a proxy cache with Curl

If you try to download a file with Curl but keep getting wrong data there may be a web proxy getting in your way that holds an outdated version of the file in its cache. To verify this take a look at the header data involved in your request:

$ curl --verbose

If the output contains a line like

X-Cache-Lookup: HIT from

the proxy probably holds an old version of the requested file in its cache. You can tell the proxy to refresh its cache by including a Cache-Control header with Curl’s -H (or --header) flag:

$ curl --verbose -H 'Cache-Control: no-cache'

If it works you will get the current version of the file. The output will probably contain two lines like these, telling you that the proxy has indeed refreshed its cache:

X-Cache-Lookup: MISS from
X-Cache-Lookup: HIT from