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 3 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 |
---|---|---|
|
@@ -3,10 +3,18 @@ api_platform: | |
version: 1.0.0 | ||
# Mercure integration, remove if unwanted | ||
mercure: ~ | ||
http_cache: | ||
public: true | ||
invalidation: | ||
enabled: true | ||
darkweak marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 | ||
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 |
||
shared_max_age: 3600 | ||
vary: ['Content-Type', 'Authorization', 'Origin'] | ||
extra_properties: | ||
standard_put: true |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,12 +1,20 @@ | ||||||
{ | ||||||
# Debug | ||||||
{$CADDY_DEBUG} | ||||||
order cache before rewrite | ||||||
cache { | ||||||
darkweak marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
api { | ||||||
souin | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
{$SERVER_NAME} | ||||||
|
||||||
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 `( | ||||||
|
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