Skip to content

Document how the virtual host name affects navigation time - #3880

Open
Burakuslendera wants to merge 4 commits into
MicrosoftDocs:mainfrom
Burakuslendera:virtual-host-name-resolution-delay
Open

Document how the virtual host name affects navigation time#3880
Burakuslendera wants to merge 4 commits into
MicrosoftDocs:mainfrom
Burakuslendera:virtual-host-name-resolution-delay

Conversation

@Burakuslendera

@Burakuslendera Burakuslendera commented Jul 25, 2026

Copy link
Copy Markdown

Rendered article sections for review:

AB#63298553


What this PR adds

This PR adds two short subsections on choosing the host name for a synthetic origin, one under each approach on this page that uses one:

  • The virtual host name mapping approach.
  • The WebResourceRequested approach.

Why

The host name is resolved by the network stack before the mapping is applied, so a name that doesn't resolve costs a DNS timeout on every navigation.
The page currently says nothing about this, and its own example maps demo, which is such a name.

The times are measured on WebView2 runtime 150.0.4078.83, on an app that serves its content through WebResourceRequested rather than folder mapping, so nothing needs the name resolved at all.
A NetLog capture names the span:

BEGIN  HOST_RESOLVER_MANAGER_JOB  host="app.local:443"  types=[A,AAAA]
END    HOST_RESOLVER_MANAGER_JOB
                                   2.007 s

That job covers exactly the interval between the main document being handed to put_Response and the renderer requesting the first subresource.
Changing only the host name collapses it:

host name document served to first subresource launch to window visible
app.local 2.012 to 2.041 s, seven runs 2419 to 2543 ms
app.localhost 11 to 79 ms 495 to 508 ms

The distinction the new text draws is the one that matters in practice.
Reserved TLDs such as .example, .test and .invalid don't help, because RFC 2606 reserves them only against registration; the resolver still queries the network and still waits for the answer.
RFC 6761 pins .localhost to the loopback interface, so the resolver answers it without a query.
Renaming to .test was measured first, and changed nothing.

Related Issue

2 seconds delay is seen with Page navigation using WebView2 & SetVirtualHostNameToFolderMapping - Issue 2381 in the "MicrosoftEdge / WebView2Feedback" repo
This Issue reports the same delay for virtual host name mapping.
The Issue has been open since 2022.
The measurement above extends it to the WebResourceRequested path, which suggests that the cost belongs to the synthetic origin itself, rather than to either API.

@Burakuslendera

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit b8e92de:

✅ Validation status: passed

File Status Preview URL Details
microsoft-edge/webview2/concepts/working-with-local-content.md ✅Succeeded View

For more details, please refer to the build report.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

@mikehoffms mikehoffms added the cat: webview2 WebView-related content. label Jul 28, 2026
@learn-build-service-prod

Copy link
Copy Markdown
Contributor

Learn Build status updates of commit 4852ff1:

✅ Validation status: passed

File Status Preview URL Details
microsoft-edge/webview2/concepts/working-with-local-content.md ✅Succeeded View

For more details, please refer to the build report.

@learn-build-service-prod

Copy link
Copy Markdown
Contributor

PoliCheck Scan Report

The following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans.

✅ No issues found

More information about PoliCheck

Information: PoliCheck | Severity Guidance | Term
For any questions: Try searching the learn.microsoft.com contributor guides or post your question in the Learn support channel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cat: webview2 WebView-related content.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants