Ich habe eine ASP.NET Webforms-Anwendung und es verwendet NWebsec. Es funktioniert wie beabsichtigt, aber ich versuche, HTTPS von Anfang an nicht nach der ersten Anfrage mit HSTS zu erzwingen. Wenn ich den URL Rewrite hinzufüge, wird er in eine Umleitungsschleife eingefügt. Das Entfernen von NWebsec und der URL Rewrite funktioniert gut. NWebsec funktioniert in jedem Fall, aber ohne das Neuschreiben, wenn sie HTTP laden, wird HTTPS nicht erzwungen. Die upgrade-insecure-requests
funktioniert nicht auf eigene Faust.NWSec und URL Rewrite konflikt
URL Rewrite-Regel
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
redirectType="Permanent" />
</rule>
NWebsec Config
<nwebsec>
<httpHeaderSecurityModule xmlns="http://nwebsec.com/HttpHeaderSecurityModuleConfig.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="NWebsecConfig/HttpHeaderSecurityModuleConfig.xsd">
<redirectValidation enabled="true" />
<setNoCacheHttpHeaders enabled="true" />
<x-Robots-Tag enabled="false" noIndex="false" noFollow="false" noArchive="false" noOdp="false" noSnippet="false" noImageIndex="false" noTranslate="false" />
<securityHttpHeaders>
<x-Frame-Options policy="Deny" />
<strict-Transport-Security max-age="60" includeSubdomains="true" httpsOnly="true" preload="false" />
<x-Content-Type-Options enabled="true" />
<x-Download-Options enabled="false" />
<x-XSS-Protection policy="Disabled" blockMode="true" />
<content-Security-Policy enabled="true">
<upgrade-insecure-requests enabled="true" />
</content-Security-Policy>
</securityHttpHeaders>
</httpHeaderSecurityModule>
</nwebsec>