add https redirection

This commit is contained in:
Ryan Peters 2021-07-22 20:54:41 -04:00
parent 2d36f0d2f6
commit 38a151e872

View File

@ -1,6 +1,7 @@
using BinaryDad.Coding.Hubs; using BinaryDad.Coding.Hubs;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
@ -21,6 +22,12 @@ namespace BinaryDad.Coding
{ {
services.AddMvc(); services.AddMvc();
services.AddSignalR(); services.AddSignalR();
services.AddHttpsRedirection(options =>
{
options.RedirectStatusCode = StatusCodes.Status301MovedPermanently;
options.HttpsPort = 443;
});
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.