Merge pull request #419 from spencerwooo/stale-while-revalidate-59
This commit is contained in:
commit
0fda1c93db
5 changed files with 8 additions and 4 deletions
|
@ -28,4 +28,8 @@ module.exports = {
|
|||
// The directLinkRegex is used to match the direct link of the file from the response of the API. We originally use this to prevent
|
||||
// unauthorised use of the proxied download feature - but that is disabled for now. So you can safely ignore this settings.
|
||||
directLinkRegex: 'public[.].*[.]files[.]1drv[.]com',
|
||||
|
||||
// Cache-Control header, check Vercel documentation for more details.
|
||||
// https://vercel.com/docs/concepts/edge-network/caching
|
||||
cacheControlHeader: 'max-age=0, s-maxage=3540, stale-while-revalidate=60'
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
|
||||
// Set edge function caching for faster load times, check docs:
|
||||
// https://vercel.com/docs/concepts/functions/edge-caching
|
||||
res.setHeader('Cache-Control', 'max-age=0, s-maxage=600, stale-while-revalidate')
|
||||
res.setHeader('Cache-Control', apiConfig.cacheControlHeader)
|
||||
|
||||
// Sometimes the path parameter is defaulted to '[...path]' which we need to handle
|
||||
if (path === '[...path]') {
|
||||
|
|
|
@ -13,7 +13,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
|
||||
// Set edge function caching for faster load times, check docs:
|
||||
// https://vercel.com/docs/concepts/functions/edge-caching
|
||||
res.setHeader('Cache-Control', 'max-age=0, s-maxage=600, stale-while-revalidate')
|
||||
res.setHeader('Cache-Control', apiConfig.cacheControlHeader)
|
||||
|
||||
if (typeof id === 'string') {
|
||||
const itemApi = `${apiConfig.driveApi}/items/${id}`
|
||||
|
|
|
@ -34,7 +34,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
|
||||
// Set edge function caching for faster load times, check docs:
|
||||
// https://vercel.com/docs/concepts/functions/edge-caching
|
||||
res.setHeader('Cache-Control', 'max-age=0, s-maxage=600, stale-while-revalidate')
|
||||
res.setHeader('Cache-Control', apiConfig.cacheControlHeader)
|
||||
|
||||
if (typeof searchQuery === 'string') {
|
||||
// Construct Microsoft Graph Search API URL, and perform search only under the base directory
|
||||
|
|
|
@ -17,7 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|||
|
||||
// Set edge function caching for faster load times, check docs:
|
||||
// https://vercel.com/docs/concepts/functions/edge-caching
|
||||
res.setHeader('Cache-Control', 'max-age=0, s-maxage=600, stale-while-revalidate')
|
||||
res.setHeader('Cache-Control', apiConfig.cacheControlHeader)
|
||||
|
||||
// Check whether the size is valid - must be one of 'large', 'medium', or 'small'
|
||||
if (size !== 'large' && size !== 'medium' && size !== 'small') {
|
||||
|
|
Loading…
Reference in a new issue