The cache TTL (time-to-live) for your media and static files is set in the .magento.app.yaml
configuration file using the expires
key.
Before updating your Production environment, we highly recommend testing changes in your Staging environment first. Submit an Adobe Commerce Support ticket to update the configuration on these environments.
Specify the TTL time (in seconds) in the web
property of the .magento.app.yaml
file. You can add the expires
key under locations
or under "/media"
and "/static"
.
To prevent the cache from expiring, use the expires: -1
key-value pair. See the following example:
# The configuration of app when it is exposed to the web.
web:
locations:
"/media":
...
expires: -1
"/static":
...
expires: -1
Add, commit, and push your code changes.
git add -A && git commit -m "Set cache TTL for static files" && git push origin <branch-name>