0
votes

Here is the scenario:

I'm serving the index document for an app engine backed angularjs application from a GAE service via <welcome-file-list>.

Requests for https://<project>.appspot.com/ serve static/index.html via

<welcome-file-list>
  <welcome-file>static/index.html</welcome-file>
  <welcome-file>index.html</welcome-file>
</welcome-file-list>

This index.html file contains a list of minimized/uglified/combined static resources with hashes in the name for cache busting purposes. All of the included assets work great, but the index.html file is cached for 600 seconds per the default caching rules on appengine.

I'd like to set no-cache headers for this file but it doesn't seem to honor expiration values configured in appengine-web.xml via <static-files>.

I've tried this

<static-files>
  <!- also without leading slash, same result -->
  <include path="/static/index.html" expiration="30s" />
1

1 Answers

1
votes

According to the documentation {1} and a similar SO question {2}, I suggest you to write something like this: (Check the expiration time pattern)

<static-files>
  <!- also without leading slash, same result -->
  <include path="/static/index.html" expiration="0d 0h 0m 30s" />

{1}: https://cloud.google.com/appengine/docs/standard/java/config/appref#static_cache_expiration

{2}: unable to set cache expiration on in app.yaml for a python app