-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Improvements to HTTPS #2308
Copy link
Copy link
Closed
Labels
enhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Metadata
Metadata
Labels
enhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Type
Fields
Give feedbackNo fields configured for issues without a type.
Introduction
Scenarios
Goals
Technical challenges
User experience
Kestrel with HTTPS during development
launchSettings.json)Kestrel wtih HTTPS as a production edge server
{ "Kestrel": { "Endpoints": { "HTTP": { "Url": "http://*:6000" }, "HTTPS": { "Url": "https://*:6443", "Certificate": { "Path": "testCert.pfx", "Password": "testPassword" } } } } }HTTPS redirection
app.UseHttpsRedirection()) simplifies redirecting to HTTPS by simplifying the configuration of the HTTPS portEnabling HSTS
app.UseHsts())Development from the command-line first run experience
Run "dotnet new razor" or "dotnet new mvc"
The .NET Core SDK installs the ASP.NET Core HTTPS development certificate as part of the first run experience
As part of the first run experience, a message is displayed with instructions for trusting the development certificate:
Run "dotnet dev-certs https --trust" to trust the ASP.NET Core HTTPS development certificate
Run "dotnet run"
Project template updates
launchSettings.jsonis generated by default, including from the command-line:{ "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:11199/", "sslPort": 44333 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "WebApplication38": { "commandName": "Project", "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", }, "applicationUrl": "https://localhost:44333;http://localhost:11199" } } }Startup.csupdated to enable HSTS and HTTPS redirect:Certificate missing error
If an HTTPS server URL is configured, but a certificate is not available an exception with the following error message is thrown:
IIS Express with HTTPS during development
IIS with HTTPS in production
Development with HTTPS in Docker
launchSettings.json.In production with HTTPS in Docker
HTTPS in Docker details
Runtime
Tooling
for HTTPS into a well-known location and with a password of their choosing.
file for the project under the right key.
the right folder location and that the password used to export the certificate is on the user secrets for the application.
Dockerfile changes
Docker compose changes
be made available inside the container.
Sample docker-compose.overrride.yml
HTTPS project