diff --git a/implementations/Crafter.Build-Clang.cpp b/implementations/Crafter.Build-Clang.cpp index 28491f8..3599f3c 100644 --- a/implementations/Crafter.Build-Clang.cpp +++ b/implementations/Crafter.Build-Clang.cpp @@ -1801,6 +1801,21 @@ int Crafter::Run(int argc, char** argv) { " header Cross-Origin-Embedder-Policy \"require-corp\"\n" " header Cross-Origin-Resource-Policy \"same-origin\"\n" " header Cache-Control \"no-store\"\n" + // Every EnableWasiBrowserRuntime consumer is a + // single-page wasm app by construction: the + // generated index.html ships an empty and + // the module builds the DOM at runtime. So an app + // that routes on window.location has no file on + // disk for any path but "/", and a bare + // file_server 404s every deep link, refresh and + // shared URL during development. + // + // try_files falls through to index.html only for + // paths that are not real files, so static assets + // still serve normally and a genuinely missing + // asset becomes a visible wrong-content-type + // rather than a silent 404 the app can't see. + " try_files {{path}} /index.html\n" " file_server\n" "}}\n", port, absDir.string()));