0

So, I've written a NodeJS application on Windows having Server Edition OS, My application basically communicates with other Softwares installed in the same system by executing some commands using NodeJS child process.

Everything is working fine on localhost, as my server has a static IP, I want to serve the application to public. How can I do this without using iisnode?

I tried using iisnode, but I am falling into issues since then, I am able to server my site, but due to some permission issues on C drive, the cmd command gives Access Denied error.

1 Answer 1

1

Option 1:

  1. Run your Node.js app at a local binding such as http://localhost:8080 Reference
  2. Set up IIS as reverse proxy Reference

iisnode is a dead project you definitely shouldn't use it any more.

Option 2:

Use HttpPlatformHandler to launch your Node.js app,

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform stdoutLogEnabled="true" stdoutLogFile=".\node.log" startupTimeLimit="20" processPath="C:\Program Files\nodejs\node.exe" arguments=".\app.js">
            <environmentVariables>
                <environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
                <environmentVariable name="NODE_ENV" value="Production" />
            </environmentVariables>
        </httpPlatform>
  </system.webServer>
</configuration>

Reference

Note that due to your Node.js installation, C:\Program Files\nodejs\node.exe might be a mapped path. You have to use the actual path instead, such as C:\Users\<user name>\AppData\Roaming\nvm\v16.13.2\node.exe.

Note that you also need to give IIS_IUSRS enough permissions to access node.exe.

Sign up to request clarification or add additional context in comments.

4 Comments

I am trying out the first option. I have issues in the configuration. Proxy server always redirects to the index route, here is my configuration: <rule name="Reverse Proxy to Alteryx Communicate" stopProcessing="true"> <match url="^api" /> <action type="Rewrite" url="localhost:5000{R:0}" /> </rule>
I want all routes to /api to my own server with full URL, currently it is redirecting to index path
@AmirSaleem Your pattern is incorrect, and your rewrite url is missing a "/". you can try this rule: <rule name="Reverse Proxy to Alteryx Communicate" stopProcessing="true"> <match url="^(api.*)" /> <action type="Rewrite" url="localhost:5000/{R:0}" /> </rule>
Thanks for your answer, your solution worked. One more thing, how do I enforce HTTPS on this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.