Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94627ba20e | ||
|
|
a782fdfe53 |
+3
-1
@@ -26,6 +26,8 @@ export default async function middleware(request: NextRequest) {
|
|||||||
pathname.startsWith('/errors') ||
|
pathname.startsWith('/errors') ||
|
||||||
pathname.startsWith('/health') ||
|
pathname.startsWith('/health') ||
|
||||||
pathname.startsWith('/uploads') ||
|
pathname.startsWith('/uploads') ||
|
||||||
|
pathname.startsWith('/media') ||
|
||||||
|
pathname.startsWith('/_next/image') ||
|
||||||
pathname.includes('/api/og') ||
|
pathname.includes('/api/og') ||
|
||||||
pathname.includes('opengraph-image') ||
|
pathname.includes('opengraph-image') ||
|
||||||
pathname.endsWith('sitemap.xml') ||
|
pathname.endsWith('sitemap.xml') ||
|
||||||
@@ -61,7 +63,7 @@ export default async function middleware(request: NextRequest) {
|
|||||||
if (['GET', 'HEAD'].includes(request.method)) {
|
if (['GET', 'HEAD'].includes(request.method)) {
|
||||||
// Clone headers to ensure all Next.js internal headers (like router state) are preserved
|
// Clone headers to ensure all Next.js internal headers (like router state) are preserved
|
||||||
const clonedHeaders = new Headers(request.headers);
|
const clonedHeaders = new Headers(request.headers);
|
||||||
|
|
||||||
effectiveRequest = new NextRequest(urlObj, {
|
effectiveRequest = new NextRequest(urlObj, {
|
||||||
headers: clonedHeaders,
|
headers: clonedHeaders,
|
||||||
method: request.method,
|
method: request.method,
|
||||||
|
|||||||
+1
-1
@@ -113,7 +113,7 @@
|
|||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"preinstall": "npx only-allow pnpm"
|
"preinstall": "npx only-allow pnpm"
|
||||||
},
|
},
|
||||||
"version": "2.3.22-rc.12",
|
"version": "2.3.22-rc.14",
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
"onlyBuiltDependencies": [
|
"onlyBuiltDependencies": [
|
||||||
"@parcel/watcher",
|
"@parcel/watcher",
|
||||||
|
|||||||
+13
-1
@@ -44,7 +44,19 @@ async function run() {
|
|||||||
urls.map(async (url) => {
|
urls.map(async (url) => {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(url, { method: 'HEAD' });
|
const res = await fetch(url, { method: 'HEAD' });
|
||||||
if (res.status >= 400) broken.push(`${url} (Status: ${res.status})`);
|
if (res.status >= 400) {
|
||||||
|
// Diagnostic: check if the raw source is available
|
||||||
|
const rawUrlMatch = url.match(/[?&]url=([^&]+)/);
|
||||||
|
if (rawUrlMatch) {
|
||||||
|
const rawPath = decodeURIComponent(rawUrlMatch[1]);
|
||||||
|
const baseUrl = new URL(url).origin;
|
||||||
|
const rawUrl = `${baseUrl}${rawPath}`;
|
||||||
|
const rawRes = await fetch(rawUrl, { method: 'HEAD' });
|
||||||
|
broken.push(`${url} (Status: ${res.status}, Raw Status: ${rawRes.status})`);
|
||||||
|
} else {
|
||||||
|
broken.push(`${url} (Status: ${res.status})`);
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
broken.push(`${url} (Fetch failed)`);
|
broken.push(`${url} (Fetch failed)`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user