asp.net - How to set up shared `system.webServer` settings for all sites on an IIS server -
i'm setting new webserver in our hosting environment. it's new vm ever used us, can want (within reason). it's running iis 7 on windows 2008 r2, asp.net 4.0 installed on system.
i'd quite force sites on server use following system.webserver
settings, unless explicitly overridden, adding them machine.config
or web.config
files in framework config folders (both 32-bit , 64-bit versions) doesn't seem have effect.
the settings i'm trying force follows. know these settings work fine within individual site's web.config
(because i've copy/pasted them production site configured myself) , know iis url rewrite module 2 installed.
<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>
these settings should mean x-powered-by:
http header absent , server:
header empty, when test this, following:
[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
am missing obvious? system.webserver
section cannot inherited these default configuration files?
see question serverfault. appear can specify iis-wide rewrite rules applicationhost.config file in c:\windows\system32\inetsrv\config. allows management , inheritance of rules via iis.
edit: ok, doesn't work... try what's recommended here, see if makes difference (forcing modules run requests may force rewriter pick inherited rewrite settings correctly).
Comments
Post a Comment