Skip to content

Commit

Permalink
feat: Env var HTTP_CACHE_SHARED_MAX_AGE
Browse files Browse the repository at this point in the history
  • Loading branch information
ambroisemaupate committed Feb 8, 2022
1 parent 9644f2c commit e543e05
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ APP_UNSPLASH_CLIENT_ID=
APP_TIMEZONE=Europe/Paris
USER_UID=1000

VARNISH_URL=http://varnish
HTTP_CACHE_MAX_AGE=60
HTTP_CACHE_SHARED_MAX_AGE=600

OPEN_ID_DISCOVERY_URL=https://accounts.google.com/.well-known/openid-configuration
OPEN_ID_HOSTED_DOMAIN=
OPEN_ID_CLIENT_ID=
Expand Down
19 changes: 19 additions & 0 deletions config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,22 @@ api_platform:
client_items_per_page: true
items_per_page_parameter_name: itemsPerPage

http_cache:
# Automatically generate etags for API responses.
etag: true
public: true
# Default value for the response max age.
max_age: '%env(int:HTTP_CACHE_MAX_AGE)%'
# Default value for the response shared (proxy) max age.
shared_max_age: '%env(int:HTTP_CACHE_SHARED_MAX_AGE)%'
# Default values of the "Vary" HTTP header.
vary: [ 'Accept', 'Authorization', 'Origin', 'Accept-Encoding', 'Content-Type' ]
invalidation:
enabled: true
varnish_urls: [ '%env(VARNISH_URL)%' ]
defaults:
cache_headers:
public: true
max_age: '%env(int:HTTP_CACHE_MAX_AGE)%'
shared_max_age: '%env(int:HTTP_CACHE_SHARED_MAX_AGE)%'
vary: [ 'Accept', 'Authorization', 'Origin', 'Accept-Encoding', 'Content-Type' ]

0 comments on commit e543e05

Please sign in to comment.