{"record":{"id":"eba34f0599db6e9b","repo":"dotnet/AspNetCore.Docs","slug":"response-statustext","errorCode":null,"errorMessage":"response.statusText","messagePattern":"response\\.statusText","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"aspnetcore/blazor/host-and-deploy/webassembly/index.md","lineNumber":146,"sourceCode":":::moniker range=\">= aspnetcore-8.0 < aspnetcore-11.0\"\n\nBlazor Web App:\n\n:::moniker-end\n\n:::moniker range=\">= aspnetcore-8.0\"\n\n```html\n<script type=\"module\">\n  import { BrotliDecode } from './decode.min.js';\n  Blazor.start({\n    webAssembly: {\n      loadBootResource: function (type, name, defaultUri, integrity) {\n        if (type !== 'dotnetjs' && location.hostname !== 'localhost' && type !== 'configuration' && type !== 'manifest') {\n          return (async function () {\n            const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });\n            if (!response.ok) {\n              throw new Error(response.statusText);\n            }\n            const originalResponseBuffer = await response.arrayBuffer();\n            const originalResponseArray = new Int8Array(originalResponseBuffer);\n            const decompressedResponseArray = BrotliDecode(originalResponseArray);\n            const contentType = type === \n              'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';\n            return new Response(decompressedResponseArray, \n              { headers: { 'content-type': contentType } });\n          })();\n        }\n      }\n    }\n  });\n</script>\n```\n\n:::moniker-end\n","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/dotnet/AspNetCore.Docs/blob/c67a80103a1a74db20784debd919c7fdda96c510/aspnetcore/blazor/host-and-deploy/webassembly/index.md#L128-L164","documentation":"JavaScript Error thrown inside loadBootResource when the Brotli-compressed (.br) resource fetch fails (response.ok is false). The custom boot-resource loader fetches defaultUri + '.br' with cache:'no-cache' for non-localhost, non-js/config/manifest resources and throws response.statusText if the fetch returns a non-OK HTTP status. Applies to ASP.NET Core 8.0+ (the >= aspnetcore-8.0 moniker).","triggerScenarios":"Hosting environment does not serve .br files (compression not enabled or files not published), CDN returns a 404/403 for the .br variant, MIME type misconfiguration causing 404, deployment missing the compressed assets, or a network/CDN transient error returning non-2xx.","commonSituations":"Publishing without Brotli compression enabled; reverse proxy stripping or not serving precompressed files; CDN cache miss for the .br variant; deployment that omitted wwwroot/_framework compressed files; CORS/auth on the static file endpoint returning 401/403.","solutions":["Verify the published wwwroot/_framework contains .br files for each boot resource.","Configure the static-file middleware / web server to serve precompressed Brotli assets with correct Content-Encoding.","If hosting without precompression, remove or simplify loadBootResource so it does not append '.br'.","Check the failing resource's URL and statusText in the browser devtools Network tab to identify 404/403/etc.","Ensure the CDN/proxy serves the same files for the .br suffix and does not require auth."],"exampleFix":"// before\nconst response = await fetch(defaultUri + '.br', { cache: 'no-cache' });\nif (!response.ok) {\n  throw new Error(response.statusText);\n}\n\n// after — fall back to uncompressed on failure\nlet response = await fetch(defaultUri + '.br', { cache: 'no-cache' });\nif (!response.ok) {\n  console.warn(`Brotli fetch failed (${response.status}) for ${defaultUri}; falling back.`);\n  response = await fetch(defaultUri, { cache: 'no-cache' });\n  if (!response.ok) {\n    throw new Error(`Boot resource ${defaultUri} failed: ${response.statusText}`);\n  }\n  return response;\n}","handlingStrategy":"fallback","validationCode":"// Validate .br availability before relying on it\nconst probe = await fetch(defaultUri + '.br', { method: 'HEAD' });\nif (!probe.ok) { /* skip compression path */ }","typeGuard":"function canServeBrotli() {\n  return 'DecompressionStream' in window || typeof BrotliDecode === 'function';\n}","tryCatchPattern":"try {\n  const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });\n  if (!response.ok) throw new Error(response.statusText);\n  // decompress...\n} catch (err) {\n  console.warn('Brotli load failed, falling back:', err);\n  return fetch(defaultUri, { cache: 'no-cache' });\n}","preventionTips":["Publish with precompressed Brotli assets enabled.","Serve .br files with correct Content-Encoding on the host/CDN.","Implement a fallback to the uncompressed resource on failure.","Inspect failing boot-resource requests in devtools Network tab."],"tags":["blazor-webassembly","javascript","brotli","static-files","cdn","loadbootresource"],"backgroundTag":null,"analyzedSha":"c67a80103a1a74db20784debd919c7fdda96c510","analyzedAt":"2026-08-13T17:46:11.763Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}