2

I had the issue that visiting my website using the IP address instead of the hostname, it would display a certificate error because the certificate is issued to the domain name only. Searching a bit on this, I found out that doing and url redirect seems to be the common method to fix this issue. For example, https://172.217.13.142 redirect to https://google.com.

So using the URL Rewrite module, I wrote this rule which seems to work:

    <rewrite>
        <globalRules>
            <rule name="IP to domain" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" />
                </conditions>
                <action type="Redirect" url="https://example.com/" appendQueryString="false" />
            </rule>
        </globalRules>
    </rewrite>

About 12hours later in the middle of the night, production server crashed and everyone panicked. "IIS Worker Process" (w3wp.exe) which usually hover around 1.5gb usage took the whole 16gb of the machine.

Restarting the site clear the memory, but it still raise rapidly. Disabling the rewrite rule stop the memory usage.

I then found this article about a memory leak in the extension, but it was for 2.0 and I'm using 2.1.

  • "url redirect seems to be the common method to fix this issue" - do you mind sharing the reference for this? I'm very surprised this would work at all? Your example (using Google's IP address) results in a cert error: NET::ERR_CERT_AUTHORITY_INVALID – MrWhite Aug 14 at 23:30
  • Do you have other sites on this same server? Is your server listening on multiple IP addresses? Why are you using a "complex" regex when you are seemingly trying to match a single IP address? – MrWhite Aug 14 at 23:40
  • Hello MrWhite. Google also give a certificate error on the first connection, but when you hit continue anyway it redirect to the hostname based url and allow you to visit the site with the valid certificate, it never let you go through to the functioning site with the IP. I do not have any reference as to why it's common, but I just tried a few well known sites and they all do that. Do you have any other solution? – Dunge Aug 15 at 13:43
  • @MrWhite As for the rule, I wanted to keep a generic solution working for all servers and dynamic IPs. But I tried with a static IP, and then with the rule disabled and it still leak memory.. – Dunge Aug 15 at 13:45
  • I was basing my solution on this thread: serverfault.com/questions/286295/… – Dunge Aug 15 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.