Score:0

Using IIS HTTPS Rewrite with Cloudflare?

sy flag

I have an IIS (10.0) server (2019) running a .NET application.

I'm using cloudflare for DNS/SSL and have the option to have CF enforce SSL. This works fine if im using the DNS name of the app, ex http://app.host.com redirects to https://app.host.com.

However, if someone attempts to access the server via the public IP, http://x.x.x.x/ they do not get redirected to HTTPS.

I attempted to use a URL Rewrite to solve this issue, while it will redirect the IP address to a HTTPS connection, it breaks the connection with cloudflare. (To many redirects).

Is there a CloudFlare friendly way of doing this? Is there a way in IIS to only have it respond on http://app.domain.com?

Worth noting that IIS is behind a firewall/router (sonicwall) that is performing the NAT.

djdomi avatar
za flag
if you use the ip of the server, cloudflare is out of scope... and then you need to ensure that the content gets redirected. but remember that it could also affect the regular visit and could potentially lead into a redirect loop
Lex Li avatar
vn flag
You can resolve this by adjusting your Cloudflare setting to enforce HTTPS connection between Cloudflare servers and your IIS server. Too many redirects only occur when you didn't enforce that.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.