Google Apps-script UrlFetchApp.fetch returning cached copy

google-apps-script

Solution

I was able to overcome this issue by using "max-age=0" in my Cache-Control header, e.g.:

var url = "http://www.stackoverflow.com";
var options =
  {
    // Ensure we get a fresh copy of the site every time.
    headers : {'Cache-Control' : 'max-age=0'}
  };
var response = UrlFetchApp.fetch(url, options)

It sounds like Google App Engine has a similar problem. Someone opened an issue however it appears to have been closed.

Problem

I am using UrlFetchApp in a google apps script to perform a get, as follows: ``` var optAdvancedArgs = { "method": "GET", "headers": {"Cache-Control": "no-cache", "Pragma": "no-cache"}, }; var response = UrlFetchApp.fetch(url, optAdvancedArgs); ``` Despite my attempt to disable the cache in the headers, the response I get is always a cached copy. If I perform a wget in my console using the same url, I see receive an up to date version. My question is: How can I really disable the cache when performing a UrlFetchApp.fetch? Is there something wrong with my code?

Original source