Share via


ContainerResourceBuilderExtensions.WithEndpointProxySupport<T> Method

Definition

Set whether a container resource can use proxied endpoints or whether they should be disabled for all endpoints belonging to the container. If set to false, endpoints belonging to the container resource will ignore the configured proxy settings and run proxy-less.

public static Aspire.Hosting.ApplicationModel.IResourceBuilder<T> WithEndpointProxySupport<T>(this Aspire.Hosting.ApplicationModel.IResourceBuilder<T> builder, bool proxyEnabled) where T : Aspire.Hosting.ApplicationModel.ContainerResource;
static member WithEndpointProxySupport : Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.ContainerResource)> * bool -> Aspire.Hosting.ApplicationModel.IResourceBuilder<'T (requires 'T :> Aspire.Hosting.ApplicationModel.ContainerResource)> (requires 'T :> Aspire.Hosting.ApplicationModel.ContainerResource)
<Extension()>
Public Function WithEndpointProxySupport(Of T As ContainerResource) (builder As IResourceBuilder(Of T), proxyEnabled As Boolean) As IResourceBuilder(Of T)

Type Parameters

T

The type of container resource.

Parameters

builder
IResourceBuilder<T>

The resource builder for the container resource.

proxyEnabled
Boolean

Should endpoints for the container resource support using a proxy?

Returns

The IResourceBuilder<T>.

Remarks

This method is intended to support scenarios with persistent lifetime containers where it is desirable for the container to be accessible over the same port whether the Aspire application is running or not. Proxied endpoints bind ports that are only accessible while the Aspire application is running. The user needs to be careful to ensure that container endpoints are using unique ports when disabling proxy support as by default for proxy-less endpoints, Aspire will allocate the internal container port as the host port, which will increase the chance of port conflicts.

Applies to