ASP.Net Core development mode no longer redirects to https.

Fixes hot module reloading through proxy.

Production mode still redirects to https.
This commit is contained in:
Harrison Deng 2021-07-10 00:04:54 -05:00
parent 3d3c43b944
commit 4e12a4b7fc
3 changed files with 4 additions and 10 deletions

View File

@ -0,0 +1 @@

View File

@ -18,7 +18,7 @@
"MultiShop": { "MultiShop": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": true, "launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000", "applicationUrl": "http://localhost:5000;https://localhost:5001",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }

View File

@ -1,10 +1,6 @@
using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; 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 Microsoft.EntityFrameworkCore;
using MultiShop.Data; using MultiShop.Data;
using MultiShop.Models; using MultiShop.Models;
@ -72,12 +68,9 @@ namespace MultiShop
app.UseHsts(); app.UseHsts();
} }
app.UseHttpsRedirection(); if (!env.IsDevelopment()) app.UseHttpsRedirection();
app.UseStaticFiles(); app.UseStaticFiles();
if (!env.IsDevelopment()) if (!env.IsDevelopment()) app.UseSpaStaticFiles();
{
app.UseSpaStaticFiles();
}
app.UseRouting(); app.UseRouting();