-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Blazor WASM: Javascript/css not compressing when using Brotli web.config #51166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@Schoof-T thanks for contacting us. I don't think the web.config applies to files that are not part of the blazor payload. That is, during publish we will compress the Blazor runtime and related files, but we won't be compressing any other static file that you add/bring. The configuration in the web.config requires the file to have been statically compressed to serve a compressed version. You can tweak the web.config to compress all the files or to enable dynamic compression on the ones that are not statically compressed, but that's something that we can't offer guidance on. |
Thanks for contacting us. We're moving this issue to the |
Thank you for the reply, that makes sense. Is there a reason why you are not compressing other files that I'm adding? I feel like that's a great way to optimize the size of a Blazor App. Might also be a good idea to add this information to the docs, because now just enabling the Brotli web.config has actually increased the file size of my Blazor App. I'm having a difficult time finding guidance on how to optimize the the files I added in combination with the brotli compression. |
I have started noticing even stranger things now. I managed to get the brotli compression working with the default generated web.config (I didn't retry the default web.config after installing IIS Compression) I publish with Auto generated web.config The web.config that gets auto generated for me is the following:
The .br files are all available after the publish. But IIS is still doing something different. |
Thanks for contacting us. We're moving this issue to the |
Closing as a dupe of #52824 |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Describe the bug
When hosting a Blazor WASM application, I want to use brotli compression for the best compression possible. However when using the Microsoft suggested web.config (https://raw.githubusercontent.com/dotnet/AspNetCore.Docs/main/aspnetcore/blazor/host-and-deploy/webassembly/_samples/web.config) mine/external libraries their javascript/css files are not longer compressed.
When using the default generated web.config, the .js and .css files are compressed.
My IIS has the following installed and enabled:
Expected Behavior
I would expect the .js and .css files to also be compressed, preferebly in brotli or otherwise in gzip.
Steps To Reproduce
Exceptions (if any)
No response
.NET Version
.NET 7
Anything else?
A secondary question, is it possible to generate the brotli web.config when running
dotnet publish
? Is this the correct way to do this? https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-7.0The text was updated successfully, but these errors were encountered: