ホスティング環境に新しい Web サーバーをセットアップしています。これは私たちだけが使用する新しい VM であるため、(理にかなった範囲内で) やりたいことを実行できます。Windows 2008 R2 で IIS 7 を実行しており、システムに ASP.Net 4.0 がインストールされています。
system.webServer
明示的にオーバーライドされない限り、サーバー上のすべてのサイトで次の設定を使用するように強制したいのですが、 Framework 構成フォルダー(32 ビット バージョンと 64 ビット バージョンの両方)内のMachine.config
またはWeb.config
ファイルにそれらを追加しても、そうはなりません。何の効果もないようです。
強制しようとしている設定は次のとおりです。これらの設定が個々のサイト内で正常に機能することWeb.config
はわかっており (自分で構成した運用サイトからコピー/貼り付けしたため)、IIS URL Rewrite Module 2が確実にインストールされていることもわかっています。
<system.webServer>
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By"/>
</customHeaders>
</httpProtocol>
<staticContent>
<remove fileExtension=".air"/>
<remove fileExtension=".svg"/>
<remove fileExtension=".ttf"/>
<remove fileExtension=".otf"/>
<remove fileExtension=".woff"/>
<remove fileExtension=".eot"/>
<mimeMap fileExtension=".air" mimeType="application/vnd.adobe.air-application-installer-package+zip"/>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml"/>
<mimeMap fileExtension=".ttf" mimeType="application/x-font-truetype"/>
<mimeMap fileExtension=".otf" mimeType="application/x-font-opentype"/>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff"/>
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject"/>
</staticContent>
<rewrite>
<outboundRules>
<rule name="Remove RESPONSE_Server">
<match serverVariable="RESPONSE_Server" pattern=".+"/>
<action type="Rewrite" value=""/>
</rule>
</outboundRules>
</rewrite>
</system.webServer>
これらの設定は、X-Powered-By:
HTTP ヘッダーが存在せず、Server:
ヘッダーが空であることを意味するはずですが、これをテストすると、次のようになります。
[12:35:56] owen@plum:~$ curl -I http://new.server.ip
HTTP/1.1 200 OK
Content-Length: 689
Content-Type: text/html
Last-Modified: Mon, 13 May 2013 15:11:24 GMT
Accept-Ranges: bytes
ETag: "2ce2122ec4fce1:0"
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Tue, 14 May 2013 11:36:16 GMT
明らかな何かが欠けていますか?system.webServer
これらのデフォルト構成ファイルからセクションを継承できないだけですか?