Skip to content

Commit

Permalink
feat: add no cache middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
betomossmann committed Mar 13, 2023
1 parent 723498a commit 0c8f6c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/middlewares/no-cache.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Request, Response, NextFunction } from 'express'

export const noCache = (req: Request, res: Response, next: NextFunction): void => {
res.set('cache-control', 'no-store, no-cache, must-revalidate, proxy-revalidate')
res.set('pragma', 'no-cache')
res.set('expires', '0')
res.set('surrogate-control', 'no-store')
next()
}

0 comments on commit 0c8f6c6

Please sign in to comment.