0

XML 投稿を受け入れるための Azure Web アプリを実行しています。cURL を使用して URL に投稿するとすべてが機能しますが、Apache Camel/HTTP を使用すると POST で 400 エラーが発生します。ログ ファイルを見ると、唯一の違いは cs-host フィールドです。cURL コマンドの場合、値は単なるドメイン (例: azurewebsites.net) ですが、Apache POST はポート 80 を追加します (例: azurewebsites.net:80)。呼び出しからポートを削除する書き換えルールを追加しました (ルールの詳細は以下を参照) が、POST は依然として 400 エラーになります。私が見つけた最も近い関連記事はここにありました: HTTP HOST ヘッダーにポート番号を含めると Service Unavailable エラーが発生しますが、残念ながら Azure Web App ではなく Netscaler に関連しているようで、解決策には詳細なガイダンスがありませんでした..ありがとう任意の入力!

書き換えルールは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <location path="domain" xdt:Locator="Match(path)">
    <system.webServer>
      <rewrite xdt:Transform="InsertBefore(/configuration/location[(@path='domain')]/system.webServer/*[1])">
        <rules>
          <rule name="domainrule1" stopProcessing="true">
            <match url="domain.azurewebsites.net:80(.*)" />
            <action type="Redirect" url="http://domain.azurewebsites.net/{R:1}" />
          </rule>
        </rules>
      </rewrite>
    </system.webServer>
  </location>
  <location path="~1domain" xdt:Locator="Match(path)">
    <system.webServer>
      <rewrite>
        <rules>
          <rule name="domainrule2" stopProcessing="true" xdt:Transform="Insert">
            <match url="domain.azurewebsites.net:80(.*)" />
            <action type="Redirect" url="http://domain.azurewebsites.net/{R:1}" />
          </rule>
        </rules>
      </rewrite>
    </system.webServer>
  </location>
</configuration>
4

0 に答える 0