From 4e12a4b7fc80f0f8abead52f9aa2ff68a9c1a21c Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Sat, 10 Jul 2021 00:04:54 -0500 Subject: [PATCH] ASP.Net Core development mode no longer redirects to https. Fixes hot module reloading through proxy. Production mode still redirects to https. --- MultiShop/client/vue.config.js | 1 + MultiShop/server/Properties/launchSettings.json | 2 +- MultiShop/server/Startup.cs | 11 ++--------- 3 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 MultiShop/client/vue.config.js diff --git a/MultiShop/client/vue.config.js b/MultiShop/client/vue.config.js new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/MultiShop/client/vue.config.js @@ -0,0 +1 @@ + diff --git a/MultiShop/server/Properties/launchSettings.json b/MultiShop/server/Properties/launchSettings.json index 1da6c37..cf48059 100644 --- a/MultiShop/server/Properties/launchSettings.json +++ b/MultiShop/server/Properties/launchSettings.json @@ -18,7 +18,7 @@ "MultiShop": { "commandName": "Project", "launchBrowser": true, - "applicationUrl": "https://localhost:5001;http://localhost:5000", + "applicationUrl": "http://localhost:5000;https://localhost:5001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/MultiShop/server/Startup.cs b/MultiShop/server/Startup.cs index a382e2b..b98c194 100644 --- a/MultiShop/server/Startup.cs +++ b/MultiShop/server/Startup.cs @@ -1,10 +1,6 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Identity.UI; -using Microsoft.AspNetCore.HttpsPolicy; -using Microsoft.AspNetCore.SpaServices.AngularCli; using Microsoft.EntityFrameworkCore; using MultiShop.Data; using MultiShop.Models; @@ -72,12 +68,9 @@ namespace MultiShop app.UseHsts(); } - app.UseHttpsRedirection(); + if (!env.IsDevelopment()) app.UseHttpsRedirection(); app.UseStaticFiles(); - if (!env.IsDevelopment()) - { - app.UseSpaStaticFiles(); - } + if (!env.IsDevelopment()) app.UseSpaStaticFiles(); app.UseRouting();