aspire icon indicating copy to clipboard operation
aspire copied to clipboard

Add support for configuring non-project resources to trust and/or use the ASP.NET Core HTTPS development certificate

Open DamianEdwards opened this issue 1 year ago • 1 comments

Some of the Aspire samples in the samples repo now demonstrate how non-project resources can be configured to use and trust the ASP.NET Core HTTPS development certificate so that they can host HTTPS endpoints that are trusted by the host browser (and other host resources) and trust the HTTPS endpoints of other resources that they connect to.

  • AspireWithNode: Configures the front-end Node.js app to host HTTPS endpoints using the dev cert and trust connections to the back-end ASP.NET Core API project which is also using the dev cert.
  • Metrics: Configures the OpenTelemetry Collector container resource to host its endpoint using HTTPS via the dev cert and trust connections to downstream collectors (like the Aspire dashboard) that also use the dev cert.
  • Keycloak: Configures the Keycloak container resource to host its endpoints using HTTPS via the dev cert and trust connections to client apps including project resources that are using the dev cert.

All of these samples utilize a common helper DevCertHostingExtensions.cs.

We should consider adding this base helper capability natively to Aspire.Hosting and then updating the various hosting integrations to utilize it along with whatever custom logic is required for that specific integration to add a resource-specific RunWithHttpsDevCertificate overload that does what's required to configure the integration to correctly use the certificate.

Related issues:

  • #5453
  • #4132

DamianEdwards avatar Dec 06 '24 18:12 DamianEdwards

Support for trusting the development certificate has been added in https://github.com/dotnet/aspire/pull/11889

danegsta avatar Oct 14 '25 19:10 danegsta