I'm using NextJS on my project. For every page requests it adds 's-maxage=31536000, stale-while-revalidate' cache-control rules in response. How are these 2 rules supposed to work together?
How does HTTP header "cache-control: s-maxage=31536000, stale-while-revalidate" work?
5.8k Views Asked by Dzianis Sudas At
1
There are 1 best solutions below
Related Questions in HTTP
- My get request for http is very slow
- Angular multiple http requests chrome android
- HttpRequestContext vs HttpContext
- Converting curl command to iOS
- getting google contacts using shuttlecloud
- Node.js http.get example
- How can hide url value in php
- Symfony2 - handle HTTP/Entity user access restrictions
- Angular http interceptor responseError doesn't have statusText
- Which of the following hostnames are valid?
- Send Http request at specific time
- Rails - read file from POST request / octet-stream
- Python - Cookies & BeautifulSoup
- Npm requests stopped by home router
- POST Android json data
Related Questions in NEXT.JS
- Getting babel build errors with the next.js getting started example
- Request Graphql api running on different port from Next.js app in development mode localhost
- Session lost when refresh the page (Next, react, isomorphism)
- HOC: A valid React element (or null) must be returned
- vscode launch config for next.js app
- Next.js + Redux server side rendering: Has data, but doesn't render on server side
- When to use a react framework such as Next or Gatsby vs Create React App
- Error: spawn EACCES on Heroku with Next.js
- Docker compose npm script command not found
- Error when using custom domain with Next.js on Heroku
- ReactJs, next JS, express and redux boilerplate
- Cannot use @import in css
- Next JS nested routing
- internal server error when deploying NextJs to firebase
- MaterialUI together with styled-components, SSR
Related Questions in CDN
- What happen when user location is near the Origin server more than CDN server?
- Track how many of our visitors that use a CDN?
- Change assets urls to cdn adding absolute path in Grunt
- Does CDN know which website the client is visiting when fetching jquery.min.js or other resource from CDN?
- CDN and Server Architecture : Picture upload feature for my web app
- Redirect image requests from locations on origin domain to CDN domain
- Not able to serve different robots.txt for CDN77
- ASP.NET MVC multiple virtualpath Bundle with CDN
- $_SESSION failing when calling PHP file through a CDN
- What is the cause of website waiting times?
- How to add CDN with Aurelia-CLI and RequireJS
- Is there a CDN service in Bluemix?
- CDN with fallback in Symfony twig using assetic
- Jquery Google CDN not recognised when loaded?
- How to use github repo as like CDN server for uploading assets file?
Related Questions in CACHE-CONTROL
- Chrome cache overriding angularjs disabling of cache
- Apache tiles - css and javascript files not visible to child pages
- What does `expires -1` mean in NGINX `location` directive?
- Httpcache on springboot
- curl -X GET -I -H "Cache-Control: no-cache" does not bypass
- How to add headers in nginx only sometimes
- OmniFaces CacheControlFilter has no effect when response contains Content-Disposition header
- nginx cache but immediately expire/revalidate using `Cache-Control: public, s-maxage=0`
- dojo app - caching static content such as imgs/css
- .html Caching in HTML
- React Native app cache images even the response headers say "no-cache"?
- cache-control not working without etag
- Can browser caching be controlled by HTTP headers alone w/o using hash names for asset files?
- What does "!" (exclamation mark) means in http header "Cache-Control: !no-store, !bypass-cache"?
- image cache header issues
Related Questions in S-MAXAGE
- Symfony2 HttpCache setSharedMaxAge() always 0
- Does it make sense to set Cache-Control max-age=0 and s-maxage= not zero?
- How to set the S-MaxAge CacheControl value in an ASP.NET app?
- jQuery load function ignores Cache-Control max-age
- How does HTTP header "cache-control: s-maxage=31536000, stale-while-revalidate" work?
- its not printing proper no.of grid points on the screen?
- Is max age relative to last-modified date or request time?
- Windows Batch Programming
- Sprockets max-age header on heroku
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
s-maxageandstale-while-revalidateare part of thecache-controlHTTP header standard that instruct caching of web objects.As your question alludes, they are allowed to be comma separated to achieve your desired caching strategy.
The first value (
s-maxage) is how long the object should be cached in seconds. It also "overridesmax-ageor theExpiresheader, but only for shared caches (e.g., proxies) and is ignored by private caches" - see HTTP expirationThe second value (
stale-while-revalidate), if supported, is how long after thes-maxageexpiration the object can be cached for until it needs to be requested from your site again.Example
cache-controldirectivesHere is how to set caching headers in Next.js.
Here is a related post I made that highlights ISR process in Next.js.