subfolder is not resolved without force typing https

I have set up the subdomain reg.example.com on a dedicated windows server 2019 (not the same server as example.com). The main url works when I don’t type https (I simply enter reg.example.com in address bar and it is being redirected to https due to web.config settings). But when I call a subfolder without https e.g reg.example.com/exam the server is not responding. If I force https manually and type https://reg.example.com/exam with https it works!

Conditions:

  • the reg.example.com is the default website on IIS.

  • website bindings is set on port 80 for http and port 443 for https and assigned the propper SSL to https.

  • I have tried checking and unchecking "Require server name indication" when assigning the ssl but no change.

  • There is A record for reg.example.com on DNS server pointing to the server IP.

  • Browsers redirect from http to https but the curl command for main doman (even without subfolders) curl --head http://reg.example.com/ says: curl: (7) Failed to connect to reg.example.com port 80: Connection refused

  • these are the codes used in web.config to redirect requests to https: and remove default document from urls:

    <rule name="RemoveWWW" patternSyntax="Wildcard" stopProcessing="true">     <match url="*" />     <conditions logicalGrouping="MatchAll">         <add input="{HTTP_HOST}" pattern="www.reg.example.com" />     </conditions>      <action type="Redirect" url="https://reg.example.com/{R:0}" redirectType="Permanent" /> </rule>    <rule name="RemoveDefaultDocument" stopProcessing="true">      <match url="(.*?)/?index\.asp$  " />      <conditions>          <add input="{HTTP_HOST}" pattern="localhost" negate="true" />      </conditions>      <action type="Redirect" url="{R:1}/" redirectType="Permanent" />  </rule>   <rule name="HTTPS" enabled="true" patternSyntax="Wildcard" stopProcessing="true">      <match url="*" negate="false" />      <conditions logicalGrouping="MatchAll">          <add input="{HTTPS}" pattern="off" />          <add input="{HTTP_HOST}" pattern="localhost" negate="true" />      </conditions>      <action type="Redirect" url="https://reg.example.com/{R:0}" redirectType="Permanent" />  </rule> 

and finally this is the error I receive after 2-3 minutes:

This site can’t be reached reg.example.com refused to connect.