mirror of
https://github.com/zoriya/v10.git
synced 2026-08-14 18:04:49 +00:00
26 lines
632 B
TypeScript
26 lines
632 B
TypeScript
import type { Config } from '@netlify/edge-functions';
|
|
|
|
export default async (request: Request) => {
|
|
const url = new URL(request.url);
|
|
|
|
// Skip PostHog proxy paths — handled by Netlify redirects
|
|
if (url.pathname.startsWith('/ph/')) return;
|
|
|
|
const redirectUrl = new URL(url.pathname.replace(/\/$/, ''), url.origin);
|
|
redirectUrl.search = url.search;
|
|
redirectUrl.hash = url.hash;
|
|
|
|
return new Response(null, {
|
|
status: 301,
|
|
headers: {
|
|
location: redirectUrl.toString(),
|
|
'cache-control': 'public, max-age=86400',
|
|
},
|
|
});
|
|
};
|
|
|
|
export const config: Config = {
|
|
cache: 'manual',
|
|
pattern: '.+/$',
|
|
};
|