Created
July 16, 2020 17:58
-
-
Save digitallysavvy/e371a2b03819d282948a85f613ba21d4 to your computer and use it in GitHub Desktop.
simple no cache function for use in an express server to force the browser to never cache the response, to ensure fresh response each time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nocache = (req, resp, next) => { | |
resp.header('Cache-Control', 'private, no-cache, no-store, must-revalidate'); | |
resp.header('Expires', '-1'); | |
resp.header('Pragma', 'no-cache'); | |
next(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment