Skip to content

Version the Let's Encrypt article #35615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions aspnetcore/fundamentals/servers/yarp/lets-encrypt.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@ uid: fundamentals/servers/yarp/lets-encrypt
title: YARP Lets Encrypt
description: YARP Lets Encrypt
author: samsp-msft
monikerRange: '<= aspnetcore-7.0'
ms.author: samsp
ms.date: 2/6/2025
ms.date: 6/13/2025
ms.topic: article
content_well_notification: AI-contribution
ai-usage: ai-assisted
---

# YARP Lets Encrypt

> [!NOTE]
> The [`LettuceEncrypt` NuGet package](https://github.com/natemcmaster/LettuceEncrypt) described in this article is archived and no longer supported, so the package isn't recommended for use.

## Introduction
YARP can support the certificate authority [Lets Encrypt](https://letsencrypt.org/) by using the API of another ASP.NET Core project [LettuceEncrypt](https://github.com/natemcmaster/LettuceEncrypt). It allows you to set up TLS between the client and YARP with minimal configuration.

YARP can support the certificate authority [Lets Encrypt](https://letsencrypt.org/) by using the API of another ASP.NET Core project, [`LettuceEncrypt`](https://github.com/natemcmaster/LettuceEncrypt). It allows you to set up TLS between the client and YARP with minimal configuration.

## Requirements

Add the LettuceEncrypt package dependency:
Add the `LettuceEncrypt` package dependency:

```csproj
<PackageReference Include="LettuceEncrypt" Version="1.1.2" />
```

## Configuration
There are required options for LettuceEncrypt that should be set, see the example of `appsettings.json`:

There are required options for `LettuceEncrypt` that should be set. See the example of `appsettings.json`:

```json
{
Expand All @@ -37,8 +43,10 @@ There are required options for LettuceEncrypt that should be set, see the exampl
},

"LettuceEncrypt": {
// Set this to automatically accept the terms of service of your certificate authority.
// If you don't set this in config, you will need to press "y" whenever the application starts
// Set this to automatically accept the terms of service of your certificate
// authority.
// If you don't set this in config, you will need to press "y" whenever the
// application starts
"AcceptTermsOfService": true,

// You must specify at least one domain name
Expand All @@ -56,16 +64,17 @@ There are required options for LettuceEncrypt that should be set, see the exampl
services.AddLettuceEncrypt();
```

For more options (i.e. saving certificates) see examples in [LettuceEncrypt doc](https://github.com/natemcmaster/LettuceEncrypt).
For more options (for example, saving certificates) see the examples in the [`LettuceEncrypt` project README](https://github.com/natemcmaster/LettuceEncrypt).

## Kestrel Endpoints

If your project is explicitly using kestrel options to configure IP addresses, ports, or HTTPS settings, you will also need to call `UseLettuceEncrypt`.
If your project is explicitly using Kestrel options to configure IP addresses, ports, or HTTPS settings, call `UseLettuceEncrypt`:

Example:

```csharp
var builder = WebApplication.CreateBuilder(args);

builder.WebHost.ConfigureKestrel(kestrel =>
{
kestrel.ListenAnyIP(443, portOptions =>
Expand All @@ -77,4 +86,3 @@ builder.WebHost.ConfigureKestrel(kestrel =>
});
});
```