Node.js application is deployed using Node.js extension.
Subpath of the website, e.g.
example.com/api/testshows error 404 is browser console.
\api\testdoes not exist on a filesystem and should be generated dynamically via Node.js.
Web application works as expected when iisnode is not used, and the required path
Node.js extension creates an URL rewrite rule in IIS as follows:
<match url="^$" />
<action type="Rewrite" url="<?= htmlentities($this->startupFile) ?>" />
The existing IIS rewrite rule is not compatible with the application.
This behavior is recognized as product defect #EXTNODEJS-46 which will be fixed in future product updates.
Connect to the server via RDP.
Open IIS Manager > SERVER_NAME > example.com > URL Rewrite > startup-file.
Change Pattern from
/*to route everything to Node.js Startup File.
Note: the solution does not address all the use cases. For example, it may be required to create the additional rewrite rule to rewrite a single subfolder only, using the folder name as a pattern.
E.g. to rewrite
example.com/api/, use the Pattern