debug: log reroute calls in hooks.ts
This commit is contained in:
@@ -24,12 +24,14 @@ export const reroute: Reroute = ({ url }) => {
|
|||||||
|
|
||||||
// Public path → internal /admin
|
// Public path → internal /admin
|
||||||
if (url.pathname === prefix || url.pathname.startsWith(prefix + '/')) {
|
if (url.pathname === prefix || url.pathname.startsWith(prefix + '/')) {
|
||||||
|
console.log(`[reroute] ${url.pathname} → /admin${url.pathname.slice(prefix.length)}`);
|
||||||
return '/admin' + url.pathname.slice(prefix.length);
|
return '/admin' + url.pathname.slice(prefix.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block direct /admin access when a custom path is configured
|
// Block direct /admin access when a custom path is configured
|
||||||
if (adminPath !== 'admin') {
|
if (adminPath !== 'admin') {
|
||||||
if (url.pathname === '/admin' || url.pathname.startsWith('/admin/')) {
|
if (url.pathname === '/admin' || url.pathname.startsWith('/admin/')) {
|
||||||
|
console.log(`[reroute] blocking direct /admin access → /404`);
|
||||||
return '/404';
|
return '/404';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user