mirror of https://github.com/buster-so/buster.git
Merge pull request #852 from buster-so/nate/many-updates
Update redirect for 307
This commit is contained in:
commit
7b7ddd2d12
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue