The role of .net core 5 Https/app.UseHttpsRedirection

https: is a middleware: UseHttpsRedirection
Function: Check whether the current project is listening on multiple ports, if any protocol is Https - we will forward it to Https by default when accessing Http

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseHttpsRedirection();
        }
  • 1
  • 2
  • 3
  • 4

exist in launchSettings.json file, "applicationUrl": "https://localhost:5001;http://localhost:5000"

{
  "iisSettings": {
    "windowsAuthentication": false,
    "anonymousAuthentication": true,
    "iisExpress": {
      "applicationUrl": "http://localhost:57281",
      "sslPort": 44300
    }
  },
  "profiles": {
    "IIS Express": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    },
    "NET5WebApplication": {
      "commandName": "Project",
      "dotnetRunMessages": "true",
      "launchBrowser": true,
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }
  }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28

Tags: The role of .net core 5 Https/app.UseHttpsRedirection

.net core http .netcore https

Related: The role of .net core 5 Https/app.UseHttpsRedirection