stop serving cache for protected routes, close #425

This commit is contained in:
spencerwooo 2022-02-13 19:09:47 +08:00
parent 0d329dee6d
commit 3254bfad35
No known key found for this signature in database
GPG key ID: 24CD550268849CA0

View file

@ -160,6 +160,9 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
// Fetch password from remote file content // Fetch password from remote file content
if (authTokenPath !== '') { if (authTokenPath !== '') {
// Don't server cached response for password protected folders
res.setHeader('Cache-Control', 'no-cache')
try { try {
const token = await axios.get(`${apiConfig.driveApi}/root${encodePath(authTokenPath)}`, { const token = await axios.get(`${apiConfig.driveApi}/root${encodePath(authTokenPath)}`, {
headers: { Authorization: `Bearer ${accessToken}` }, headers: { Authorization: `Bearer ${accessToken}` },