Inside this directory is my Node app: /wwwroot/poldeb/internal_affairs_incident_reporter
My app is running on port 8080.
In IIS, this is my configuration:
I can get to www.poldeb.com fine because I have a static HTML page there, but when I try to get to www.poldeb.com/IAIR where my Node.js app should be running, I get a 403 error. How do I access my Node.JS app from this subdomain?
I got through this error by refactoring my IIS structure. I made IAIR its own website and gave it the subdomain iair.poldeb.com. Inside of IAIR, this was my web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="sendToNode">
<match url="/*" />
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I also had to give write access to the user IIS_IUSRS for the internal_affairs_incident_reporter directory.
Related
I have created simple node application with routing.
Startup File to app.js and after browsing the domain like this :https://api.lemontrade.in/ and see
only app.js file is working but when I want get customers with url https://api.lemontrade.in/customers I am getting 404 error.
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
You should add this in your web.config file if you are using IIS / Windows hosting.
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="myapp">
<match url="/*" />
<action type="Rewrite" url="app.js" />
</rule>
<!-- Don't interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^app.js\/debug[\/]?" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Our use case consists of the following aspects:
Ci/CD Using Azure Devops in order to ensure automation and monitoring.
Azure AppService based on windows
Our React projects consists of: Frontend asking a server-side script (server.js) for a url to embed.
server.js performs some authentications and modifications and returns a single url "live" for a specific period of time.
Running on local station using npm start and starting the server using node of course works perfectly.
But when deploying to a windows-based AppService, I cant see how to start the server.js.
My CI is npm installing and ZIPing the artifact.
CD is deploying the artifact and serving the index.js web page.
But I cant seem to see how to start the server.js file.
Feels like I am missing some important piece regarding IIS and web.config
you could try to add the below code in your web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<webSocket enabled="false" />
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="server.js"/>
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
I have a website built on Angular7 with server side rendering deployed on an Azure App Service. I had to add a web.config file in order to make the server.js run.
Here's the web.config file
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<webSocket enabled="false" />
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="server.js"/>
</rule>
</rules>
</rewrite>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<httpErrors existingResponse="PassThrough" />
</system.webServer>
</configuration>
This site is deployeed to mysite.com and everything works fine.
I now need to create a virtual directory mysite.com/app to hold a different application (on the old AngularJS). Without the server side rendering I just create the virtual directory on Azure Portal and everything works fine. Because of the server side and the "redirection" to server.js the virtual directory is no longer working.
Is there any Rule to put on the web.config file to ignore the requests of /app, not to run the nodejs server?
I got my response on another question (credit to dana) so I've just added the rule
<rule name="ignore app application" stopProcessing="true">
<match url="^app" />
<action type="None" />
</rule>
before the other rules. This way if the url typed is mysite.com/app the node server won't be "activated" and the virtual directory works as expected.
I have a node js application that works fine in my localhost and in AWS. I deployed it to Azure with the following web.config file in the root of the directory:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>
<iisnode nodeProcessCountPerApplication="4" />
</system.webServer>
</configuration>
In addition, I have a file iisnode.yml, also at the root of directory, with the line:
nodeProcessCountPerApplication: 4
The root directory contains a file index.js which is the entry point to the application, and it is configured to run an express app on port process.env.PORT || 1337. In package.json, the start command is node index.js.
The application gets deployed, but for every route I try to run I see the following error:
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Please try to add the rewrite mode in the web.config file, beside the handlers tag under system.webServer tag:
<rewrite>
<rules>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="index.js"/>
</rule>
</rules>
</rewrite>
Any update, please feel free to let me know.
I am using Windows Azure Websites to host a node.js application. So far everything is great except for my custom errors. In my node app I have an error handler that renders a custom 404 and custom 500 error page just fine on my local machine. However, as soon as I publish to azure it overrides the response when I set the statusCode to anything except 200.
If I don't pass the 500 or 404 statusCode to the response then this does not happen, but I do want the status codes to make it to the browser. Locally I get my custom error page just fine:
However, on azure websites it only returns a single line of text:
The page cannot be displayed because an internal server error has occurred.
I tried creating my own web.config to override the default one with custom errors disabled but that didn't seem to have any effect. Here is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<customErrors mode="off" />
</system.web>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="app.js"/>
</rule>
</rules>
</rewrite>
<iisnode
debuggingEnabled="true"
devErrorsEnabled="true"
debuggerPathSegment="debug"
nodeProcessCommandLine=""%programfiles(x86)%\nodejs\node.exe""
logDirectory="..\..\LogFiles\nodejs"
watchedFiles="*.js;iisnode.yml;node_modules\*;views\*.jade;views\*.ejb;routes\*.js" />
</system.webServer>
</configuration>
I'm not sure if iisnode (the extension for iis that routes requests to node.js) is responsible for overriding my error pages or if iis itself is responsible. Any suggestions?
Well nevermind, I found the issue. If anyone else is having the same problem simply add the following under <system.webServer> in web.config:
<httpErrors existingResponse="PassThrough" />
Had a similar problem with MVC project hosted in windows azure. On local machine hosted under IIS was working fine but on live machine I was getting the following error "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
Adding this to web config under system.webServer saved my day
My web.config looks like this
<system.web>
***
<customErrors mode="RemoteOnly" defaultRedirect="~/Error/PageNotFound">
<error statusCode="404" redirect="~/Error/PageNotFound" />
<error statusCode="500" redirect="~/Error/ServerError"/>
</customErrors>
</system.web>
***
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>