Add cache to raw file api
This commit is contained in:
parent
0fcad4d421
commit
605c075083
@ -16,6 +16,7 @@ export default async function handler(req, res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
res.setHeader("Content-Type", file.contentType); // Set the content type header
|
res.setHeader("Content-Type", file.contentType); // Set the content type header
|
||||||
|
res.setHeader("Cache-control", "public, max-age=3600"); // Cache the file for 1 hour
|
||||||
readStream.pipe(res); // Send the file to the client
|
readStream.pipe(res); // Send the file to the client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user