Skip to content
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

[wasm] implement browser cache busting for JSHost.ImportAsync #74815

Open
pavelsavara opened this issue Aug 30, 2022 · 7 comments
Open

[wasm] implement browser cache busting for JSHost.ImportAsync #74815

pavelsavara opened this issue Aug 30, 2022 · 7 comments
Assignees
Milestone

Comments

@pavelsavara
Copy link
Member

pavelsavara commented Aug 30, 2022

Similar to what Blazor does or with file hash in mono-config.json applied as query string.

Also cache busting for JSHost.ImportAsync

@pavelsavara pavelsavara added this to the 8.0.0 milestone Aug 30, 2022
@pavelsavara pavelsavara self-assigned this Aug 30, 2022
@ghost
Copy link

ghost commented Aug 30, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Similar to what Blazor does or with file hash in mono-config.json applied as query string.

Author: pavelsavara
Assignees: pavelsavara
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript

Milestone: 8.0.0

@maraf
Copy link
Member

maraf commented Apr 21, 2023

Fingerprinting is handled by the static web assets. We should probably add modules for JSHost.ImportAsync into boot config and pick fingerprinted URL from there

@pavelsavara
Copy link
Member Author

JSHost.ImportAsync could be any URL, not just current project.
It could be some 3rd party CDN.

Users could already add ?guid=cb2a5dff-1f74-4d35-b8cf-c6327b2f45b1 or ?etag=whatever-xxx1.
But that doesn't check integrity. I think that is the missing bit there.
Could <script type="importmap"> help somehow ?

@maraf
Copy link
Member

maraf commented Apr 21, 2023

JSHost.ImportAsync could be any URL, not just current project.
It could be some 3rd party CDN.

Does it block us from using it through boot config? Just omit the fingerprinting of course, but it could be the place to provide integrity.

@pavelsavara
Copy link
Member Author

If there was such section in boot config, how would the hashes get there. We are not going to download from CDN in order to calculate the hash, right ? Should we have MSbuild item for adding records there and let user to drive it ?

The JSHost.ImportAsync is just dynamic JS import(). That doesn't have integrity. Unless we are willing to inject prefetch tags into DOM.
For cache busting we could append the query string on our own.

But I feel this may be overstepping our responsibilities ?

@maraf
Copy link
Member

maraf commented Apr 21, 2023

That dynamic import doesn't support integrity is good point. My though was that it would be user job to fill msbuild item with integrity.

For CDNs I think it's their job to provide good caching story and I would let user to do it manually if needed (appending query string).

For local scripts, SWA will put fingerprint into assets with name like file.[fingerprint].js and I would use boot config to load such fingerprinted modules.

@maraf
Copy link
Member

maraf commented Jul 13, 2023

Moving to .NET 9 as the underlaying issue has moved dotnet/aspnetcore#47000

@maraf maraf modified the milestones: 8.0.0, 9.0.0 Jul 13, 2023
@pavelsavara pavelsavara assigned maraf and unassigned pavelsavara Jul 13, 2023
@maraf maraf changed the title [wasm] implement browser cache busting [wasm] implement browser cache busting for JSHost.ImportAsync Jul 24, 2024
@maraf maraf modified the milestones: 9.0.0, Future Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants