1
I’m setting up a server IIS
to run an application asp.net core 1.0
but the application is https
and by typing www.dominio.com.br it does not redirect to the https
, I have already made the following settings:
<!--<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
and in the Startup.cs
I put the following code inside the method Configure:
app.Use(async (httpContext, next) =>
{
var url = httpContext.Request.GetDisplayUrl();
if (!url.StartsWith("https"))
{
httpContext.Response.Redirect("https://www.dominio.com.br" + (httpContext.Request.Path.HasValue ? httpContext.Request.Path.Value : string.Empty), true);
return;
}
await next();
});
Still no one’s solved it, does anyone have any idea how I can do it?