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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
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.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
