I am using varnish with default magento 2.3.3 VCL and the default nginx configuration that comes with magento install. At present I see the expires is set to -1. How can I set expires to one week?
status: 200
content-length: 22478
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
content-encoding: gzip
accept-ranges: bytes
access-control-expose-headers: Content-Length, Content-Range
vary: Accept-Encoding
expires: -1
server: nginx
strict-transport-security: max-age=31536000
pragma: no-cache
cache-control: no-store, no-cache, must-revalidate, max-age=0
date: Mon, 04 Jan 2020 15:04:45 GMT
x-frame-options: SAMEORIGIN
access-control-allow-headers: DNT,User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Range
content-type: text/html; charset=UTF-8
access-control-allow-origin: *
access-control-allow-methods: GET, POST, OPTIONS
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @riyaaaz,
In order to set the expires time for your cache, you’ll need to add it to your location block where caching has been allowed.
It will look something like this
location ~* \.(?:*)$ {
expires 2d;
add_header Pragma public;
add_header Cache-Control "public"
}
See the expires 2d. That means that every cache will expire after 2 days.
Regards, KDSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.