πŸ› Vercel not serving pre-compressed assets (brotli)

Vercel currently ignores any pre-compressed assets that are uploaded, for example /_framework/dotnet.native.wasm, compressed to /_framework/dotnet.native.wasm.br, and appears to retrieve the uncompressed file, and do its own compression before serving it to the client. This is inefficient, as I compress my assets with a higher level of compression at build time. I believe the behaviour is the same for gzip, however I am most concerned with br (brotli).

Note that if you call or navigate to /_framework/dotnet.native.wasm.br directly in a browser or postman, you do get the original br compressed file (validated by file size and hash).

Current: Retrieves uncompressed file and performs own compression before serving.
Expected: Retrieves a pre-compressed file based on the incoming Accept-Encoding header, and returns that directly, without doing any of its own compression.

Deployment URL or Custom Domain: https://matthew-parker-dev-blazor.vercel.app/
Environment (local, preview, production): production
Project Framework: Blazor Wasm
Build Settings:
  Framework Preset: Other
  Build Command (if not default): chmod +x build-cloudflare.sh && ./build-cloudflare.sh
  Output Directory (if not default): output/wwwroot
  Install Command (if not default):
Node/Runtime Version: 20.x
Package Manager: N/A
Relevant Packages: N/A

Thanks for reaching out, @mattparkerdev. Vercel supports both gzip and brotli compression. Fast Origin Transfer is automatically compressed and Image Optimization uses compression and modern file formats to reduce image and video file sizes.

If you can share a minimal reproducible example showing how your project compresses assets at build time and retrieves uncompressed files, that will help me investigate the issue

Hi Amy,

Thanks for looking into this for me.
Here is a minimal repro: GitHub - MattParkerDev/VercelNotServingPrecompressedAssetsRepro
There is a README.md in the repo explaining how to reproduce :slight_smile:
Feel free to reach out if you have any more questions!

Matt

Hi @amyegan, is there any update on this?

Replying to keep open, as issue is not resolved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.