Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cache-control in google app engine

I'm trying to optimize page serving time on Google app engine, but I'm struggling at getting the effect I want.

in my app.yaml, I used the following directive:

handlers:
- url: /assets
  static_dir: assets
  expiration: 7d

under the asset folder, I have all my images, css and js. By using the 7d expiration, I would have expected the browser to use the local cached files and not come to my app for 7 days.

Although, in the response headers for my assets I get the following:

Cache-Control:public, max-age=604800
Cache-Control:no-cache, must-revalidate

I understand that with these headers, the browser will check on my app if the file as changed before releasing the cached version. (I can effectively see a bunch of 304 corresponding to my files under the asset folder, for both refresh and simple page load).

Is there a way in Google app engine to configure the cache behavior so the browser will not comeback for those files for 7d (on a simple page load), as specified in the expiration? (i.e. removing the "no-cache" from cache-control header)

P.S. I dont want to enable PageSpeed on my app. I want full control on the html served.

like image 579
sboire Avatar asked Feb 11 '13 23:02

sboire


People also ask

What is caching in GCP?

A cacheable response is an HTTP response that Cloud CDN can store and quickly retrieve, thus allowing for faster load times.

What is memcache in App Engine?

Dedicated memcache provides a fixed cache capacity assigned exclusively to your application. It's billed by the GB-hour of cache size and requires billing to be enabled.

What are the different ways of storing application data in Google App Engine?

To store data and files on App Engine, you can use Google Cloud services or any other storage service that is supported by your language and is accessible from your App Engine instance. Third-party databases can be hosted on another cloud provider, hosted on premises, or managed by a third-party vendor.


1 Answers

Are you logged on with an Admin-account by any chance? AppEngine adds some private headers about the costs for Admins and disables caching because that data is private. Logging out solved the problem for me.

like image 130
Arjen Avatar answered Sep 20 '22 03:09

Arjen