简体   繁体   中英

Blazor integrity error for framework DLL, one subdomain works the other not

I have two blazor applications with exactly same code, one running on the url https://subdomain1.domain.com and the other on https://subdomain2.domain.com

These applications are hosted blazor webassembly. They are sitting behind nginx. subdomain1 is running on port 5001 and the subdomain2 running on 4001.

Although the code is exactly a copy of each other, one works the other gives the integrity error.

Failed to find a valid digest in the 'integrity' attribute for resource 'https://subdomain2.domain.com/_framework/Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll' with computed SHA-256 integrity 'iv4AO84pmcItgSK0QEAXm56IouVakVhOaLOsHuhCELY='. The resource has been blocked.

Unknown error occurred while trying to verify integrity.

I see the request coming in and being delivered in the nginx logs

000.000.000.000 - - [10/Sep/2021:21:59:44 +0100] "GET /_framework/Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll HTTP/1.1" 200 27798 "https://subdomain2.domain.com/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36 Edg/93.0.961.38"

I cannot figure out why is that one subdomain is giving integrity errors with the framework DLL and the other not, as anyone ever came across something like this?

So long story short, the problem was in the compressed file. So, my app is in.net6-preview6. Some time back I installed preview7, but then there is the issue with the globalization so I had to uninstall preview7.

When I publish from Visual Studio 2019, it publishes the Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll of the preview 6, BUT... the Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll.br and the Microsoft.AspNetCore.Components.WebAssembly.Authentication.dll.gz inside contain the dll of the preview7.

I found out by decompressing the gz using 7zip.

The only reason that it was working on the subdomain1 was because the file already existed in the cache.

I deleted all./bin./obj folder in the solution and built everything again. Don't know how the compressed files keep coming up with the preview7, but now I know, before publishing I need to run my clean up. do.net clean is not enough, I had to delete the actual folders.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM