Repository navigation
[docs] Document explicit Kestrel certificate configuration preservation - #1669
Conversation
Adds a note to the certificate-configuration doc explaining that WithProjectDefaults preserves an existing explicit Kestrel certificate selection (Path, KeyPath, or Subject) instead of overwriting it with the default PFX mapping, per microsoft/aspire#20133. Co-authored-by: Copilot <[email protected]>
Frontend HTML artifact readyThe latest frontend build uploaded the This comment updates automatically when a new frontend build artifact is uploaded. |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Final human review is recommended.
Review effort: Lite
Findings: None
What changed in this PR
This pull request documents preservation of explicit Kestrel certificate configuration for .NET project resources.
Changes:
- Explains default PFX mapping by
WithProjectDefaults. - Documents preservation of existing PEM, certificate-store, and password settings.
- Explains the PEM/PFX mixing failure scenario.
| File | Description |
|---|---|
src/frontend/src/content/docs/app-host/certificate-configuration.mdx |
Adds Kestrel certificate-preservation guidance. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
David Pine (IEvangelist)
left a comment
There was a problem hiding this comment.
Automated docs-accuracy review
Phase A source of truth: microsoft/aspire @ release/13.6 (SHA 63b5556c7f4de9b259d6ba71a312f597a72bf307), source PR microsoft/aspire#20133 (commit e01d15dae2, "Preserve explicit Kestrel certificate configuration").
Claims extracted: 4 non-narrative → 4 verified, 0 verified-with-nuance, 0 unverifiable, 0 contradicted.
Phase B (doc-tester): exercised /app-host/certificate-configuration/ — 0 critical, 0 warnings.
Verdict: APPROVE — the new Aside describes the preservation behavior exactly as implemented.
Phase A — Claim verification
✅ Verified claims (4) — evidence
- C1 —
WithProjectDefaultsmaps the available HTTPS certificate to Kestrel's default PFX env vars (Kestrel__Certificates__Default__Pathand…__Password) for TLS-enabled project endpoints (certificate-configuration.mdx:354-357): verified.ProjectResourceBuilderExtensions.csXML doc: "For TLS-enabled endpoints, an available HTTPS certificate is mapped to Kestrel's default certificate"; implementation setsctx.EnvironmentVariables[KnownAspNetCoreConfigNames.KestrelCertificatesDefaultPath] = ctx.PfxPathand[KestrelCertificatesDefaultPassword] = ctx.Password. - C2 — If an earlier
WithHttpsCertificateConfigurationcallback already set…Default__Path,…__KeyPath, or…__Subject(case-insensitive), the default PFX mapping is skipped entirely and the existing configuration — including any password — is left untouched (certificate-configuration.mdx:357-362): verified. Implementation short-circuits:if (ctx.EnvironmentVariables.Keys.Any(name => string.Equals(name, KestrelCertificatesDefaultPath, StringComparisons.EnvironmentVariableName) || …KeyPath || …Subject)) { return Task.CompletedTask; }. XML doc: "The presence of any of them preserves the existing certificate configuration, including its password. Settings supplied by earlier HTTPS certificate callbacks participate in this check." - C3 — Config-key names
Kestrel__Certificates__Default__Path/…__Password/…__KeyPath/…__Subject(Aside): verified.KnownAspNetCoreConfigNamesconstants match all four names verbatim. - C4 — Skipping prevents Aspire from mixing an explicit PEM certificate/key pair with a replaced PFX path, which Kestrel can't load (
certificate-configuration.mdx:362-364): verified. Implementation comment: "Preserve an explicit certificate selection as a group. Replacing a PEM Path with a PFX path while retaining KeyPath makes Kestrel load incompatible files. microsoft/aspire#20019".
Case-insensitivity note: StringComparisons.EnvironmentVariableName => StringComparison.OrdinalIgnoreCase — confirms the "matched case-insensitively" wording.
Phase B — Doc-tester results
Scope: the single doc route touched by this PR. Tested against the live production site (release/13.6 is not yet published, no per-PR preview exists, and frontend deps are not installed in this hourly job).
Critical issues: none.
Warnings: none.
Passed checks:
/app-host/certificate-configuration/loads (200; title "Certificate configuration").- Insertion point is clean: the
HttpsCertificateConfigurationCallbackAnnotationContextbullet list (ExecutionContext,Resource) is immediately followed by the## Certificate trust configurationheading, so the new note Aside lands between them. - The section's heading anchors resolve in the on-page table of contents.
Knowledge gaps / limitations:
- PR content isn't deployed, so the new Aside couldn't be rendered as it will appear.
- The Kestrel default-certificate env-var mapping / skip behavior can't be exercised from the docs site. Phase A confirmed it from source (
ProjectResourceBuilderExtensions.csskip logic,KnownAspNetCoreConfigNames,OrdinalIgnoreCase).
Automated review. Phase A reads microsoft/aspire source; Phase B validates the rendered docs site as a blind user; only PR-changed content and its routes were in scope.
f3d0e9e
into
release/13.6
Documents changes from microsoft/aspire#20133
@karolz-msTargeting
release/13.6based on the source PR milestone13.6.Why this is needed
microsoft/aspire#20133 fixes a bug where
WithProjectDefaults()would overwrite an explicitly configured Kestrel certificate for .NET project resources with TLS-enabled endpoints. When a resource already used an explicit PEM certificate/key pair (or a certificate storeSubject) viaWithHttpsCertificateConfiguration, Aspire's default PFX mapping replacedKestrel__Certificates__Default__Pathwhile leavingKeyPathin place, producing a mixed PFX/PEM configuration that Kestrel rejected with "The provided key file is missing or invalid."The fix preserves the entire existing certificate configuration (untouched) whenever
Kestrel__Certificates__Default__Path,Kestrel__Certificates__Default__KeyPath, orKestrel__Certificates__Default__Subjectis already present (matched case-insensitively), and only falls back to the default PFX mapping when none of those keys exist.What changed
Added a note to
src/frontend/src/content/docs/app-host/certificate-configuration.mdx, in the "Customize certificate configuration" section, explaining:WithProjectDefaultsmaps the available HTTPS certificate to Kestrel's default PFX environment variables for .NET project resources with TLS-enabled endpoints.Kestrel__Certificates__Default__Path,Kestrel__Certificates__Default__KeyPath, orKestrel__Certificates__Default__Subject.Files modified
src/frontend/src/content/docs/app-host/certificate-configuration.mdx(updated existing page — added an<Aside type="note">in the "Customize certificate configuration" section)