I have a react web application that I'm hosting on a Windows Server.
In IIS
I created URL Rewrite
rules. When I view the website from within our network the rewrite rules work and it redirects from HTTP to HTTPS.
However since port 80 is closed on the public side when i try to view the website in HTTP it never redirects and just times out. I'm assuming that's because it never actually hits the page since the port is closed so the redirect never kicks in.
Is there a way to still get the website to redirect to HTTPS with that port closed?
Here is how my web.config
file looks:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<httpRedirect enabled="false" destination="https://mywebsitehere.com" />
<rewrite>
<rules>
<rule name="http to https" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://mywebsitehere.com/{R:1}" redirectType="SeeOther" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>