Node.js IIS Server Routing 404 Errors

I’m using a node.js application. Everything works perfectly fine as expected in local wappler development. However, when I deploy via FTPS to my on prem IIS node.js server running as a mp2 service. The routing breaks and every single page returns the same {“status”:“404”,“message”:"/ not found."}.

The local port for the http server module is 3001 and is seen from outside the server as https://website.com using a local reverse proxy module.

I can’t for the life of me figure out how to fix this issue.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="ReverseProxyInbound" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://localhost:3001/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

It’s quite possible your .htaccess file didn’t get uploaded to the server?

I can’t seem to find a .htaccess file in my local project file or on the server.

In your file manager, right click on your root folder and select Show Hidden.

What folder should I expect it to be under? I’ve searched the directory and it’s still not showing, I’m sure its user error.

It should be in your root folder …

uh oh

Oh, its a Node project … is the routes file uploaded?

image

Yes it its on local and the server.

Hmmm, then I am out of ideas. Thats the only thing that I can think of that would effect all routes. Maybe someone with better Node understanding can jump in here.

@guptast or @TMR would either of you be able to assist with this? I noticed both of ya’ll were assisting with IIS routing in the forms before. I’m beyond stuck at this point and any help at all would be much appreciated!

1 Like

Hi @Liquid_Ice, I’m not running the node apps on IIS anymore. I switched to Docker sometime ago and have also deleted the website/folder under the IIS settings. So I can’t check the exact setup I had at that time.

See if these points can help you in troubleshooting this issue:

  1. IIS - URL Rewrite & ARR (Application Request Routing) extensions
  2. Reverse Proxy - you have already set it up to Port:3001
  3. Site Bindings to Port 80 and Port 443 (Not to Port:3001 as this is required to be setup as Reverse Proxy only)

I followed this link to setup the node project on IIS. The comment section could be helpful in resolving the issue.
Hosting a Node.js application on Windows with IIS as reverse proxy - DEV Community

Is your server running PLESK on Windows Server? My problem was caused by a very particular folder set up concerning PLESK and Windows Server.

The exact solution for that is here:

If you arent running PLESK then I would start by looking at what default folder paths are set in your server side set up.