Search code examples
phplaravelgoogle-app-enginecache-controlapp.yaml

Expiration in handlers in app.yaml for google app engine and laravel are not working


I use google app engine to serve my laravel application and would like to set the expiration time of my javascript and css files located in the public folder in laravel.

Response header of js and css files:

cache-control: max-age=600, public

Which is the default of google app engine.

But in my app.yaml I set the following:

runtime: php
env: flex

runtime_config:
document_root: public

skip_files:
- .env

# I tried to set this to see if the error is in my handlers, but it was 
# still the default 10mins
default_expiration: "30d"

handlers:
- url: /js/.*
  static_dir: public/js
  expiration: "30d"

- url: /css/.*
  static_dir: public/css
  expiration: "30d"

Somehow I can't overwrite the defaults of google and I dont know any further to be honest.

I already disabled the session.cache_limiter in php.ini, like it was suggested here Laravel response Cache-Control headers always containing 'no-cache'

Still no difference.


Solution

  • You are using AppEngine flexible environment: env: flex which does not support default_expiration and expiration, try using standard environment.