-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #123 from lidofinance/feature/ethui-664-dao-voting…
…-add-cache-for-pages File cache middleware
- Loading branch information
Showing
3 changed files
with
151 additions
and
109 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { cacheControlMiddlewareFactory } from '@lidofinance/next-cache-files-middleware' | ||
|
||
export const CACHE_HEADERS_HTML_PAGE = | ||
'public, max-age=30, stale-if-error=1200, stale-while-revalidate=30' | ||
export const CACHE_ALLOWED_LIST_FILES_PATHS = [ | ||
{ path: '/', headers: CACHE_HEADERS_HTML_PAGE }, | ||
{ path: '/settings', headers: CACHE_HEADERS_HTML_PAGE }, | ||
{ path: /vote\/(.+)/, headers: CACHE_HEADERS_HTML_PAGE }, | ||
{ path: /dashboard\/(.+)/, headers: CACHE_HEADERS_HTML_PAGE }, | ||
] | ||
|
||
// use only for cache files | ||
export const middleware = cacheControlMiddlewareFactory( | ||
CACHE_ALLOWED_LIST_FILES_PATHS, | ||
) | ||
|
||
export const config = { | ||
// paths where use middleware | ||
matcher: [ | ||
'/manifest.json', | ||
'/favicon:size*', | ||
'/', | ||
'/settings', | ||
'/vote/:voteId*', | ||
'/dashboard/:page*', | ||
], | ||
} | ||
|
||
export default middleware |
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
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