I have a very simple website I'm using for testing purposes that I want to support HTTP. Presently all HTTP requests are being automatically redirected to HTTPS. Here are the steps to reproduce the app:
In Visual Studio 2019 create a new ASP.NET Core Web Application. Choose ASP.NET Core 3.1 and Empty for the project template. Disable "Configure for HTTPS". Right-click the new project and select "Publish...". Publish the app to a new App Service.
After publishing browse to the website. It will redirect you to HTTPS. Here's what I've already tried to remedy this.
In the Azure portal configure the newly created app service. Ensure App service authentication is off. In TLS/SSL settings set "HTTPS Only" to off.
In Program.cs add the UseUrls option.
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseUrls("http://localhost:8001");
webBuilder.UseStartup<Startup>();
});
In launchSettings.json ensure the application URL uses http.
None of the above solutions have worked for me.
If you're getting a 307 redirect, make sure you aren't calling app.UseHttpsRedirection();
in Startup.cs (thanks https://stackoverflow.com/a/61818466/40783)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With