mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Fix zip downloads by adding _routes.json for Cloudflare Pages Functions
Without _routes.json, the SPA fallback was serving index.html instead of invoking the download Functions, causing zip downloads to return HTML. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
7d2d42da96
commit
3908cb397e
+10
-1
@@ -255,7 +255,16 @@ function generateCFConfig(buildDir) {
|
||||
`;
|
||||
fs.writeFileSync(path.join(buildDir, '_redirects'), redirects);
|
||||
|
||||
console.log('✓ Generated Cloudflare Pages config (_headers, _redirects)');
|
||||
// _routes.json: tell Cloudflare Pages which paths invoke Functions
|
||||
// Without this, the SPA fallback serves index.html for function routes
|
||||
const routes = {
|
||||
version: 1,
|
||||
include: ['/api/download/*'],
|
||||
exclude: [],
|
||||
};
|
||||
fs.writeFileSync(path.join(buildDir, '_routes.json'), JSON.stringify(routes, null, 2));
|
||||
|
||||
console.log('✓ Generated Cloudflare Pages config (_headers, _redirects, _routes.json)');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user