mirror of
https://github.com/immich-app/immich
synced 2026-08-22 13:13:05 +00:00
feat: perform 302 redirect at server level during maintenance
This commit is contained in:
parent
961f022602
commit
0801935ca9
1 changed files with 7 additions and 7 deletions
|
|
@ -131,14 +131,14 @@ export class MaintenanceWorkerService {
|
|||
return next();
|
||||
}
|
||||
|
||||
const shareKey = request.url.match(/^\/share\/(.+)$/);
|
||||
const shareSlug = request.url.match(/^\/s\/(.+)$/);
|
||||
const maintenancePath = '/maintenance';
|
||||
if (!request.url.startsWith(maintenancePath)) {
|
||||
const params = new URLSearchParams();
|
||||
params.set('continue', request.path);
|
||||
return res.redirect(`${maintenancePath}?${params}`);
|
||||
}
|
||||
|
||||
res
|
||||
.status(shareKey || shareSlug ? 500 : 200)
|
||||
.type('text/html')
|
||||
.header('Cache-Control', 'no-store')
|
||||
.send(index);
|
||||
res.status(200).type('text/html').header('Cache-Control', 'no-store').send(index);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue