Hi,
To follow up on this, if you request System.Private.CoreLib.wasm.br weâll serve that pre-compressed file as-is. We donât automatically recognize that System.Private.CoreLib.wasm.br is the pre-compressed version of System.Private.CoreLib.wasm, and we donât auto-swap to it. I donât think we do anything automatic like that.
To serve your pre-compressed Unity assets without Vercel re-compressing them, you can use rewrites with a has rule (Accept-Encoding: br) and set headers on the .br files. Example vercel.json:
{
"rewrites": [
{
"source": "/:name*.wasm",
"has": [{ "type": "header", "key": "Accept-Encoding", "value": ".br." }],
"destination": "/:name.wasm.br"
},
{
"source": "/:name*.framework.js",
"has": [{ "type": "header", "key": "Accept-Encoding", "value": ".br." }],
"destination": "/:name.framework.js.br"
},
{
"source": "/:name*.data",
"has": [{ "type": "header", "key": "Accept-Encoding", "value": ".br." }],
"destination": "/:name.data.br"
}
],
"headers": [
{
"source": "/(.)\.wasm\.br",
"headers": [
{ "key": "Content-Type", "value": "application/wasm" },
{ "key": "Content-Encoding", "value": "br" },
{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" },
{ "key": "Vary", "value": "Accept-Encoding" }
]
},
{
"source": "/(.)\.framework\.js\.br",
"headers": [
{ "key": "Content-Type", "value": "application/javascript; charset=utf-8" },
{ "key": "Content-Encoding", "value": "br" },
{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" },
{ "key": "Vary", "value": "Accept-Encoding" }
]
},
{
"source": "/(.*)\.data\.br",
"headers": [
{ "key": "Content-Type", "value": "application/octet-stream" },
{ "key": "Content-Encoding", "value": "br" },
{ "key": "Cache-Control", "value": "public, max-age=31536000, immutable" },
{ "key": "Vary", "value": "Accept-Encoding" }
]
}
]
}
Important notes:
-
Make sure the .br files are actually present in your output (e.g., in public/ or your static output directory).
-
Donât set Content-Encoding: br on the non-.br paths; only set it on the .br files. With the rewrite + headers above, Vercel will serve the pre-compressed file and wonât re-compress it.
-
You can verify with:
-
curl -I -H âAccept-Encoding: brâ https://your-domain/name.wasm
-
You should see Content-Encoding: br and the .br asset being served.
-
Also test without Accept-Encoding: br to ensure the uncompressed fallback works.
This approach should avoid Safari issues caused by double-compression while retaining Brotli for clients that support it. If you still see re-compression after this setup, please share a URL and weâll inspect the response headers from the edge.