Enable Redirect and Rewrite rules in IIS web.config

My page is a Single Page Application and handles its own routes and so needs a Rewrite for any request to be managed by the index.html itself, like this:

   <rule name="SPA Routes" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        <!-- under the /api directory -->
        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
    <!-- rewrite it to /index.html -->
    <action type="Rewrite" url="/index.html" />

And now my page is also HTTPS, so I would like to redirect any attempt to HTTP for it. I tried the bellow, but not work:

   <rule name="HTTP/S to HTTPS Redirect" enabled="true" stopprocessing="true">
    <match url="(.*)"/>
    <conditions logicalgrouping="MatchAny">
      <add input="{SERVER_PORT_SECURE}" pattern="^0$"/>
    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}/index.html" redirecttype="Permanent"/>

Is there a way to work with both?