Merge pull request #852 from buster-so/nate/many-updates

Update redirect for 307
This commit is contained in:
Nate Kelley 2025-09-10 17:06:06 -06:00 committed by GitHub
commit 7b7ddd2d12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 16 deletions

View File

@ -7,23 +7,9 @@ export const securityMiddleware = createMiddleware({ type: 'function' }).server(
// Check if this is an embed route by examining the request URL
const request = getWebRequest();
const url = new URL(request.url);
const isEmbed = url.pathname.startsWith('/embed/');
const isEmbed = url.pathname.startsWith('/embed');
// Check if this is a redirect route that might be cached
const isRedirectRoute =
url.pathname === '/' || url.pathname === '/app' || url.pathname === '/app/';
// Set security headers BEFORE calling next() to ensure they're set only once
const headers = createSecurityHeaders(isEmbed);
// Add cache control headers for redirect routes to prevent caching issues
if (isRedirectRoute) {
headers['Cache-Control'] = 'no-cache, no-store, must-revalidate';
headers['Pragma'] = 'no-cache';
headers['Expires'] = '0';
}
setHeaders(headers);
setHeaders(createSecurityHeaders(isEmbed));
const result = await next();
return result;