# SubscribeHttpsEndpointsUpdate

- Module: [Aspire.Hosting](/reference/api/go/aspire.hosting.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`Resource`](/reference/api/go/aspire.hosting/resource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Subscribes to the `BeforeStartEvent` and invokes the specified callback when an HTTPS certificate is determined to be available for the resource. This is used to conditionally update endpoint URI schemes or perform other HTTPS-related configuration at startup.

## Remarks

The callback is invoked when either:
-
-
Switch an endpoint to HTTPS when a certificate is available:
```
builder.SubscribeHttpsEndpointsUpdate(ctx =>
{
builder.WithEndpoint("http", ep => ep.UriScheme = "https");
});
```

## Definition

```go
func (Resource) SubscribeHttpsEndpointsUpdate(callback func(obj HttpsEndpointUpdateCallbackContext)) Resource
```

## Parameters

- `callback` (`func(obj HttpsEndpointUpdateCallbackContext)`) -- The callback to invoke when HTTPS is enabled. Receives an `HttpsEndpointUpdateCallbackContext` providing access to the service provider, resource, and application model.

## Returns

[`Resource`](/reference/api/go/aspire.hosting/resource.md) -- The updated resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`CSharpAppResource`](/reference/api/go/aspire.hosting/csharpappresource.md)
- [`ContainerRegistryResource`](/reference/api/go/aspire.hosting/containerregistryresource.md)
- [`ContainerResource`](/reference/api/go/aspire.hosting/containerresource.md)
- [`DotnetToolResource`](/reference/api/go/aspire.hosting/dotnettoolresource.md)
- [`ExecutableResource`](/reference/api/go/aspire.hosting/executableresource.md)
- [`ExternalServiceResource`](/reference/api/go/aspire.hosting/externalserviceresource.md)
- [`ParameterResource`](/reference/api/go/aspire.hosting/parameterresource.md)
- [`ProjectResource`](/reference/api/go/aspire.hosting/projectresource.md)
