Repository navigation
Conversation
The template web.config had no SPA fallback, so a deep link to a client route returned a 404 (#22227 in unoplatform/uno). It also looked for pre-compressed files under _compressed_br and _compressed_gz, folders the current publish output no longer has, so IIS served everything uncompressed. Requests for a path with no matching file or directory now serve index.html, except under _framework and package_* where a missing file must still fail and is marked no-store. Pre-compressed files are looked up next to the original as .br and .gz, with a server variable driving the Content-Encoding so that a client route ending in .br or .gz is not mislabelled. Fingerprinted files under _framework and package_* are cached as immutable and everything else revalidates. MIME entries are removed before being added so the file loads on any server, whichever of these types it already defines, and every pre-compressed extension is mapped to its original type so the webassembly and module script responses keep their types.
The SPA fallback rewrote to the site-absolute /index.html and the cache rules matched REQUEST_URI anchored at the site root, so a publish dropped into a subfolder or sub-application served the parent site's index.html for deep links and lost the immutable policy on its fingerprinted files. Inbound rules now match the folder-relative URL and set Cache-Control directly for present and missing fingerprinted files, the fallback rewrites to a relative index.html, and the only outbound cache rule left applies no-cache to responses that have no policy yet.
mikernet
added a commit
to Singulink/Singulink.UI
that referenced
this pull request
Oct 10, 2026
…ching and MIME types Matches the reworked template in unoplatform/uno.templates#2267, which also serves the app correctly from a site subfolder.
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue (If applicable): closes #2266, closes unoplatform/uno#22227
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The
web.configin the WebAssembly template has no SPA fallback, so a deep link to a client route on IIS returns a 404. The pre-compressed file lookup also targets_compressed_brand_compressed_gzfolders that the current publish output does not contain, so IIS serves everything uncompressed. No cache policy is defined, and the MIME table only covers a few types.What is the new behavior?
index.html./_framework/or/package_*still fails with a 404 instead of being served the app root, and that 404 is markedno-storeso a CDN or browser never caches the failure. Detection is done with a server variable set by the inbound rule, because URL Rewrite exposes no response status to outbound rules..brand.gz, matching the current publish output. A server variable set by the inbound rule drives theContent-Encodingoutbound rule, so a client route that happens to end in.bror.gzis not mislabelled./_framework/and/package_*are served withpublic, max-age=31536000, immutable; everything else, including SPA fallbacks, is served withno-cache.index.html..gzand.brentries mapped to the original type so.wasmresponses keepapplication/wasmand module scripts keepapplication/javascript.Validated with IIS Express 10 (URL Rewrite 2.1) against a
net10.0-browserwasmpublish of the Uno SamplesApp, with no MIME types defined at server level, in root, subfolder, and sub-application layouts, each in detailed-error mode and with a file-based custom 404 page (the mode remote clients get from a default IIS install). A full sweep requesting every published file withbr,gzip, and no encoding (21,735 requests) returned the expected encoding, byte length, content type, and cache policy for every file of a listed type; the only failures were 404s for build leftovers with unlisted extensions. Spot checks:/withbrtext/html,no-cache, uncompressed (index.html served directly)/index.htmlwithgziptext/html,Content-Encoding: gzip,no-cache/_framework/dotnet.native.wasmwithbrapplication/wasm,Content-Encoding: br, immutable/_framework/icudt_CJK.datwithgzipapplication/octet-stream,Content-Encoding: gzip, immutable/package_<hash>/Uno.Wasm.jswithgzip, deflate, brapplication/javascript,Content-Encoding: br, immutable/package_<hash>/.../OpenSans-Bold.ttfwithbrfont/ttf,Content-Encoding: br, immutable/some/deep/linkwithbrno-cache, noContent-Encoding/documents/asdf.brwithbrno-cache, noContent-Encoding/_framework/nope.jsno-storewith a custom error page,privatewith detailed errors/package_<hash>/nope.pngPR Checklist
Please check if your PR fulfills the following requirements:
Other information
The
package_*immutable cache policy matches the existingstaticwebapp.config.json. Note thatuno-config.jsinsidepackage_*is rewritten after the package fingerprint is computed (see the discussion on the linked issue), which affects both files equally; a follow-up will address that separately.Internal Issue (If applicable):