Skip to content

Commit

Permalink
Attempt to improve caching
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuebert committed May 25, 2024
1 parent ef45487 commit c2efc38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ const pipeFile = async (res, path) => {

const redirectFile = async (res, path) => {
const signedUrl = await generateSignedUrl(bucket.file(path));
res.setHeader('Expires', new Date(Date.now() + 60 * 1000).toUTCString());
return res.redirect(301, signedUrl);
};

const handleFileRequest = async (parentDomain, subDomain, filePath, res) => {
// Handles file requests by determining the appropriate file path and serving the file.

if (filePath.endsWith('/')) {
if (filePath.endswith('/')) {
// If the path ends with '/', serve the directory index.html
filePath = path.join(filePath, 'index.html');
} else if (!getExtension(filePath)) {
Expand Down

0 comments on commit c2efc38

Please sign in to comment.