Azure Appサービスとして実行されているエクスプレスベースのnode.jsアプリケーションがあります。 他のウェブサイトのコンテンツを処理することができます。ウェブサイトのURLはリクエストURLの一部として渡す必要があります。たとえば、アプリがhttp://myapp.com
で実行され、処理したいウェブサイトがhttp://example.com
の場合、URLはhttp://myapp.com/process/http://example.com
です。 私はローカルでアプリケーションを実行すると、処理は動作しますが、私はそれを展開するとき、それは物理的なパスとしてURLを解決しようとするため、IISは、アプリケーション・プロセスに要求を聞かせていないので、次のエラーログを提供します。Azure App Service上のIISは、実行中のノードアプリケーションがそれを処理するのではなく、URLを物理パスとして解決します。
サーバーの応答が
The page cannot be displayed because an internal server error has occurred.
であるため、リクエストは私のアプリケーションでは処理されません。エラーを処理するようにexpressを設定しましたが。
リクエストURLにはプロトコルが含まれていますが、プロトコルを除外するにはapiを変更するのは望ましくないためです。
私は、URL書き換えルールを何も成功せずに変更しようとしました。現在、私は、アプリケーションの実行中の他の部分を維持するために、次の、デフォルトのweb.configファイルを使用します。
<?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>
だから私の目標は、IISが自分のアプリケーションからの要求を処理させることです。要求からプロトコルを削除せずに可能ですか?
UPDATE:パスがURLエンコードされた場合でも、これは、発生したため、http://myapp.com/process/http%3A%2F%2Fexample.com
がちょうど同じ出力を生成します。