Static cache not expiring since yesterdays outage

48 views
Skip to first unread message

Sam Edge

unread,
Oct 13, 2018, 12:17:59 AM10/13/18
to Google App Engine
Since yesterdays outage (https://status.cloud.google.com/incident/cloud-networking/18016), the static files on my AppEngine Standard PHP55 deploys are stale. 

For instance:


runtime: php55
api_version: 1

default_expiration: "28d"

handlers:
- url: /build
static_dir: build


Usually when this sort of thing happen you can deploy a new version of your service and it busts any cache issue but I must have tried a dozen times and nothing happening. And yes I've definitely been cleaning my local caches ;)

I also changed the bucket used when deploying for a clean upload but no difference.

gcloud app deploy --version next --bucket gs://test-bucket-empty

Overnight my application started serving the right files again but when I deployed it reverted back to the stale cache it was serving yesterday.

I note that in the outage that Google Storage was affected, so I assume they are still mitigating the issue. 

Just putting this out there - is anyone else experiencing this or am I going mad?

Sam Edge

unread,
Oct 14, 2018, 10:31:31 AM10/14/18
to Google App Engine
Follow up:

Wasn't anything to do with the outage - just a coincidence. Found this in the docs:

The expiration time will be sent in the Cache-Control and Expires HTTP response headers, and therefore, the files are likely to be cached by the user's browser, as well as by intermediate caching proxy servers such as Internet Service Providers. After a file is transmitted with a given expiration time, there is generally no way to clear it out of intermediate caches, even if the user clears their own browser cache. Re-deploying a new version of the app will not reset any caches. Therefore, if you ever plan to modify a static file, it should have a short (less than one hour) expiration time. In most cases, the default 10-minute expiration time is appropriate.

So I accidentally set some static files I wanted to redeploy with a long expiration -- not sure to expire until November 10th.

I was planning to release my project this week but this is a blocker. Anyone been in this spot before?

Jason Collins

unread,
Oct 15, 2018, 12:27:37 AM10/15/18
to Google App Engine
A common technique is to add a fake version number in the query string for your static resources, e.g., 


You'll need to add something in your templating engine to add the fake version number when emitting a link to a static resource. Then, just increment your fake v number when you want an "expiration".

Aref Amiri (Cloud Platform Support)

unread,
Oct 15, 2018, 1:41:52 PM10/15/18
to Google App Engine

Hi Sam,


As it is mentioned in the Google Documentation, once the file is cached on the users end, it stays there for the time specified in the handler. Since your default expiration is set to 28 days, the cached file will expire and ready to be updated after 28 days.


However, as Jason mentioned, there are common techniques that can be applied to help you save time and avoid the delay. You can refer to the following link to get a better idea of what techniques can be used which may help you in this case: https://css-tricks.com/strategies-for-cache-busting-css/


Reply all
Reply to author
Forward
0 new messages