New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(httpcache): souin integration #2487
base: main
Are you sure you want to change the base?
Changes from all commits
136676a
16c814f
8269002
0a86bc8
7ede32f
6f0fb64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -7,6 +7,18 @@ api_platform: | |||||||
defaults: | ||||||||
stateless: true | ||||||||
cache_headers: | ||||||||
max_age: 0 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. HTTP Cache Headers should only be set on prod env There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment still valid for |
||||||||
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)%'] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6,6 +6,8 @@ | |||||
|
||||||
log | ||||||
|
||||||
cache | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be enabled through an env var:
Suggested change
Then, declare this env var in docker-compose.prod.yml and helm chart to only enable cache on production |
||||||
|
||||||
# Matches requests for HTML documents, for static files and for Next.js files, | ||||||
# except for known API paths and paths with extensions handled by API Platform | ||||||
@pwa expression `( | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,13 @@ 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: | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not enable cache on dev |
||
order cache before rewrite | ||
cache { | ||
api { | ||
souin | ||
} | ||
} | ||
restart: unless-stopped | ||
volumes: | ||
- php_socket:/var/run/php | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A declared env var without being used, especially in dev/test environments, will throw an error in Symfony commands