-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Currently, the cloudflare adapters do not serve the static assets correctly if a base path config is set. This is because the adapters look for the filename such that it is the base path + the filename but the SSR manifest only stores the filename without the base path prefix.
Example SSR manifest:
export const manifest = (() => {
function __memo(fn) {
let value;
return () => value ??= (value = fn());
}
return {
appDir: "_app",
// app path correctly includes the base path
appPath: "base/_app",
// the static assets don't have the base path prefix
assets: new Set(["favicon.png"]),Currently the filename is the request URL pathname (which includes the base path). It will never match with the manifest assets if a base is configured. (e.g., base/favicon.png will never map to favicon.png)
kit/packages/adapter-cloudflare/src/worker.js
Lines 31 to 35 in 3351047
| const filename = stripped_pathname.substring(1); | |
| if (filename) { | |
| is_static_asset = | |
| manifest.assets.has(filename) || manifest.assets.has(filename + '/index.html'); | |
| } |
This doesn't appear to be fixed. For example, if I set my base to /blog, and then upload to Cloudflare Pages, everything works except anything in the static folder. Everything in static folder is completely inaccessible. The structure of the contents in Cloudflare Pages appears to be correct, the files are there, they are under the subfolder blog, but when I attempt to navigate to them I get a 404. In addition, if I attempt to navigate to them using root, it goes into an infinite refresh loop.
Originally posted by @elucidsoft in #11245 (comment)