Set cache for static files
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.
NOTE
Before updating your Production environment, it is important to test changes in your Staging environment. Submit an Adobe Commerce Support ticket for help with updating the configuration on these environments.
-
Specify the TTL time (in seconds) in the
web
property of the.magento.app.yaml
file. You can add theexpires
key underlocations
or under"/media"
and"/static"
.To prevent the cache from expiring, use the
expires: -1
key-value pair. See the following example:code language-yaml # 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.
code language-bash git add -A && git commit -m "Set cache TTL for static files" && git push origin <branch-name>
recommendation-more-help
05f2f56e-ac5d-4931-8cdb-764e60e16f26