microsoft / microsoft/aspire

Allow to proxy from HTTPS to HTTP

Open
#6,869 1 comment 0 reactions 0 assignees View on GitHub
area-app-model
Dominant language
C#
Stars
6.3k
Forks
991
Avg merge
2d 15h
Merged PRs (30d)
196

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

When using `.WithHttpEndpoint()` Aspire automatically proxies, from an HTTP endpoint to target HTTP endpoint.

When using `.WithHttpsEndpoint()` Aspire automatically proxies from an HTTPS endpoint to target HTTP endpoint. In this scenario, it leverages .NET dev cert, which is trusted, a nice to have when working with web apps locally, so the user doesn't get security alerts.

However, there is no way to have an HTTPS endpoing proxying to a target HTTP endpoint. For instance, when serving a web site and working with OAuth, one might need to use HTTPS.

On Azure, the platform takes care of proxying from HTTPS to HTTP.
Aspire doesn't offer the same, so one has to implement SSL locally with custom certs, to be created and configured, leading to more work. Another approach is spinning up, only locally, a reverse proxy app/container like stunnel, grok, and similar, to do that, something like this:

```csharp
var httpApp = builder
.AddProject()
.WithHttpEndpoint();

var httpsApp = builder.AddProject()
.WithEnvironment("TARGET_ENDPOINT", httpApp.GetEndpoint("http"))
.WithHttpsEndpoint();
```

### Describe the solution you'd like

Allow to map from HTTPS to HTTP, something like

```csharp
var httpsApp = builder
.AddProject()
.WithHttpsEndpoint(httpsTarget = false); // the internal endpoint will be http://...
```

This way, the HTTPS endpoint will leverage .NET dev cert, and the internal endpoint is a simple HTTP endpoint that doesn't require and SSL configuration.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.