Quantcast
Channel: Configuration & Scripting
Viewing all articles
Browse latest Browse all 780

IIS on Azure App Service resolves url as physical path instead of let the running node application handle it

$
0
0

I have an express based node.js application running as an Azure App Service. It is capable to process the content of other websites. The website's URL should be passed as the part of the request URL, for example if my app runs at http://myapp.com and the website I want to process is http://example.com then the URL is:http://myapp.com/process/http://example.com. The processing works when I run the application locally but when I deploy it, IIS does not let the application process the request because it tries to resolve the URL as physical path, therefore provides the following error log:

error

The request is not handled by my application because the server response is: 

The page cannot be displayed because an internal server error has occurred.
 although I set up express to handle errors.

I am pretty sure, it is because the request url includes the protocol but it is undesired to modify the api to exclude the protocol.

I tried to modify the URL rewrite rules without any success. Currently I use the following, default web.config to keep the other parts of the application running:

<?xml version="1.0" encoding="utf-8"?><configuration><system.webServer><webSocket enabled="false"/><handlers><!--Indicates that the server.js file is a node.js site to be handled by the iisnode module --><add name="iisnode" path="src/server/app.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="^src/server/app.js\/debug[\/]?"/></rule><!--First we consider whether the incoming URL matches a physical file in the /public folder --><rule name="StaticContent"><action type="Rewrite" url="public{REQUEST_URI}"/></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="src/server/app.js"/></rule></rules></rewrite><!--'bin' directory has no special meaning in node.js and apps can be placed in it --><security><requestFiltering><hiddenSegments><remove segment="bin"/></hiddenSegments></requestFiltering></security><!--Make sure error responses are left untouched --><httpErrors existingResponse="PassThrough"/></system.webServer></configuration>

So my target is to let IIS handle the request by my application. Is it possible without removing the protocol from the request?


Viewing all articles
Browse latest Browse all 780

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>