2

ロード バランサーの背後にあるプライベート NuGet サーバーをホストしています。ロード バランサーは ssl トラフィック (442) を受け入れ、Web サーバーのポート 80 に転送します。

NuGet は要求しているプロトコルを検出しているように見え、http と https のベース href を返します。

したがって、https://nuget.privaterepo.orgに対する要求は、次の内容で返されます。

<service xml:base="http://nuget.privaterepo.org/nuget/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app">
  <workspace>
    <atom:title>Default</atom:title>
    <collection href="Packages">
      <atom:title>Packages</atom:title>
    </collection>
  </workspace>
</service>

<service xml:base="http://nuget.privaterepo.com/nuget/"...これにより、プロトコルの違いに<service xml:base="https://nuget.privaterepo.com/nuget/"...気付くはずです。

だから...私はservice xml:basewithの値をアウトバウンドに書き換えようとしていhttpsます。次のように:

<configuration>
  <system.webServer>
    <rewrite>
      <outboundRules rewriteBeforeCache="true">
        <rule name="Rewrite Product Outbound" preCondition="IsHTML" enabled="true" stopProcessing="true">
          <match filterByTags="A, CustomTags" customTags="NuGet service base" pattern="http://" ignoreCase="true" />
          <action type="Rewrite" value="https://{HTTP_HOST}{REQUEST_URI}" />
        </rule>
        <preConditions>
          <preCondition name="IsHTML" logicalGrouping="MatchAny">
            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/xml" />
            <add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/atom+xml" />
          </preCondition>
        </preConditions>
        <customTags>
          <tags name="NuGet service base">
            <tag name="service" attribute="xml:base" />
            <tag name="feed" attribute="xml:base" />
          </tags>
        </customTags>
      </outboundRules>
    </rewrite>
  </system.webServer>
</configuration>

つまずきにぶつかったのは、<tag name="service" attribute="xml:base" />正しいと思われる書き込みです。ただし、httpsプロトコルで値を書き換えているわけではありません。

NuGet サーバーと同じ出力を使用するテスト プロジェクトでこれをテストしました。書き換えルールに変更xml:baseすると、テストプロジェクトを使用して動作します。base

4

0 に答える 0