I am trying to compress my Blazor application as much as possible by following their compression section. When I run dotnet publish -c Release it will automatically create both .gz and .br files. I run the site through Nginx on a Plesk server, and I have confirmed Brotli compression works simply by testing my site via https://www.brotli.pro/
When I load the site, files like blazor.wasm (~1000 KB) are loaded with these response headers:
Server: nginx
Content-Type: application/wasm
Content-Length: 1010659
Connection: keep-alive
X-Powered-By: PleskLin
Accept-Ranges: bytes
However, other static files like JSON and CSS files are loaded with Content-Encoding: br. The DLLs and files from Blazor aren't even loaded with GZip compression as a fallback, even though the request headers say they can:
Accept-Encoding: gzip, deflate, br
I can get around this by following Microsoft's guide, and adding decode.min.js from Google's Brotli library, however, that adds ~70 KB of additional unnecessary data and honestly shouldn't be needed. If I run IIS with a web.config file it probably also works. If I visit /blazor.wasm.br, it starts downloading the file, so it definitely exists, which was also confirmed by using the Brotli decoder script.
Any idea what I am doing wrong?
It seems like a combination of updating to HTTP/2 on my Plesk server and adding
brotli_static on;under additional nginx directives worked.