diff --git a/api/config/packages/api_platform.yaml b/api/config/packages/api_platform.yaml index bbe9091492..677d251179 100644 --- a/api/config/packages/api_platform.yaml +++ b/api/config/packages/api_platform.yaml @@ -3,18 +3,22 @@ api_platform: version: 1.0.0 # Mercure integration, remove if unwanted mercure: ~ - http_cache: - public: true - invalidation: - enabled: true - purger: 'api_platform.http_cache.purger.souin' - urls: ['%env(SOUIN_API_URL)%'] # Good defaults for REST APIs defaults: stateless: true cache_headers: max_age: 0 - shared_max_age: 3600 vary: ['Content-Type', 'Authorization', 'Origin'] extra_properties: standard_put: true + +when@prod: + defaults: + cache_headers: + shared_max_age: 3600 + http_cache: + public: true + invalidation: + enabled: true + purger: 'api_platform.http_cache.purger.souin' + urls: ['%env(SOUIN_API_URL)%'] \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index c42976d7e7..69027afc69 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -22,7 +22,7 @@ services: environment: MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET} MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET} - CADDY_GLOBAL_OPTIONS: | + CADDY_GLOBAL_OPTIONS: > order cache before rewrite cache { api { diff --git a/docker-compose.yml b/docker-compose.yml index 69c21ecfc0..7487ec2627 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -36,7 +36,7 @@ services: SERVER_NAME: ${SERVER_NAME:-localhost}, caddy:80 MERCURE_PUBLISHER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} MERCURE_SUBSCRIBER_JWT_KEY: ${CADDY_MERCURE_JWT_SECRET:-!ChangeThisMercureHubJWTSecretKey!} - CADDY_GLOBAL_OPTIONS: | + CADDY_GLOBAL_OPTIONS: > order cache before rewrite cache { api {