http://computertriksno1.blogspot.in/

Node Expressjs api host under angular build project in iis using web.config

26 Sept 2018 2 comments





<configuration>
  <system.webServer>
    <!-- indicates that the hello.js file is a node.js application
    to be handled by the iisnode module -->
  <staticContent>
    <remove fileExtension=".woff" />
 <remove fileExtension=".json" />
    <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
    <mimeMap fileExtension=".json" mimeType="application/json" />
  </staticContent>
    <!-- use URL rewriting to redirect the entire branch of the URL namespace
    to hello.js node.js application; for example, the following URLs will
    all be handled by hello.js:

        http://localhost/node/urlrewrite/myapp
        http://localhost/node/urlrewrite/myapp/foo
        http://localhost/node/urlrewrite/myapp/foo/bar/baz?param=bat
   
    -->

 <handlers>
            <add name="iisnode" path="api/backend/src/server.js" verb="*" modules="iisnode" />
        </handlers>
<rewrite>
      <rules>
     <rule name="HTTPS force" enabled="true" stopProcessing="true">
   <match url="(.*)" />
   <conditions>
   <add input="{HTTPS}" pattern="^OFF$" />
   </conditions>
   <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
  </rule>
  <rule name="API" stopProcessing="true">
          <match url="api/*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="api/backend/src/server.js" />
        </rule>
        <rule name="AngularJS Routes" stopProcessing="true">
          <match url=".*" />
          <conditions logicalGrouping="MatchAll">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
          </conditions>
          <action type="Rewrite" url="/" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

Share this article :

+ comments + 2 comments

30 September 2021 at 12:45

You can watch on YouTube => Click Here

!!!Demo!!! Please hold up the excellent work. We need far more this kind of webmasters such as you on the web and also much fewer spammers. Great friend!
Thanks a lot for posting, it was quite helpful and told me quite a bit
sodium hypochlorite amazon
china air purifier
korean air purifier brands
!!!Demo!!!

Post a Comment

 
Support : GDDon | Creating Website | Gddon |
Copyright © 2013. Computer Tricks and Tips for System - All Rights Reserved
Template Created by Creating Website Modify by GDDon.Com
Proudly powered by Blogger