MicrosoftEdge / WebView2Feedback

Feedback and discussions about Microsoft Edge WebView2
https://aka.ms/webview2
453 stars 55 forks source link

[Problem/Bug]: Request to WASM file is not resolved to virtual host sometimes #4838

Open tomysaw opened 1 month ago

tomysaw commented 1 month ago

What happened?

Configuration: I'm developing a WinUI3 application running a WebView2 to open pspdfkit viewer. For that, I create a virtual host mapping to a directory where the library files are located

var folder = Path.GetDirectoryName(indexPagePath);
var index = Path.GetFileName(indexPagePath);

webView.CoreWebView2.SetVirtualHostNameToFolderMapping(host, folder, CoreWebView2HostResourceAccessKind.Allow);
webView.CoreWebView2.Navigate($"http://{host}/{index}?{query}");

The host value is app-beta.ourdomain.com

Problem: Recently we've started experiencing a weird issue. Upon library initialization it sends a lot of requests to source files. Two of those are .wasm and .wasm.js and they fail with 404. In the dev tools I see that it actually gets resolved to a real IP address of our host instead of being mapped to the local folder.

image

Which makes it even more weird is that if I click "Edit and Resend" the request works just fine.

Regression: It used to work fine when we were releasing the app. The issues was first noticed last week. Gradually it affected most of our users. Can it be a windows update?

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

129.0.2792.65

SDK Version

1.0.2210.55

Framework

WinUI3/WinAppSDK

Operating System

Windows 11

OS Version

22631.4169

Repro steps

Explained in "What happened". Let me know how I can assist

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

momo-AUX1 commented 1 month ago

Same issue here, did you try maybe intercepting the request if it has ".wasm" or ".wasm.js", read the file itself and return the stream via a new web response?

khmyznikov commented 1 week ago

I see other folks from Win App Community face same issue: https://discord.com/channels/372137812037730304/630451531984011274/1299000463374553121