Compartilhar via


Registry values for IIS URL Rewrite

The following registry values can be set for the IIS URL Rewrite module and will affect the global behavior of the module; use them at your own risk :)

All these values (DWORD) can be set under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite

MaxBackReferences – By default 31 (maximum value). Defines the maximum number of back-references that can be used. For example, if you set it to 9, administrator won’t be able to use {R:10} in their rewrite expressions.

RewriteCacheEnabled – By default 1 (true). Enables (1) or disables (0) the internal cache of rewritten URLs. Disabling it will have a negative performance impact.

RewriteCacheThreshold – By default 512. Change it to something smaller if the query string in your URLs varies too much and you are seeing too much memory consumption. The value represents the maximum of cached items per URL path. For example, ‘/cars?drive=0’ and ‘/cars?drive=1’ is one URL path ‘/cars’ that has two different query strings, this registry setting control how many variants of ‘/cars’ can be cached; but it doesn’t control how may URL paths can be cached (e.g. ‘/cars’, ‘/bikes’); that is controlled by how frequently hit is the URL path. Read frequentHitThreshold and frequentHitTimePeriod.

UrlDecodeAllowsDoubleEncoding – By default 1 (true). The module provides a UrlDecode built-in function that allows to decode strings like %25 into single characters. The function will fail by default if finds a double encoded string like %252E, where %25 is first decoded to (%) and in a second pass %2E is decoded to (.). Setting this registry value to 0 can be security problem.

InboundRewriteEnabled – By default 1 (true). Setting this value to 0 (false) will make URL Rewrite to stop listening the IIS notifications, even if you have inbound rules, it won’t process them.

OutboundRewriteEnabled – By default 1 (true). Setting this value to 0 (false) will make URL Rewrite to stop listening notifications for sending responses. This also affects the logRewrittenUrl feature, it will stop working because it relies on those IIS notifications.

LogRewrittenUrlEnabled – By default 1 (true). It can be used to disable the logRewrittenUrl feature.

All these values are read during startup, so you need to recycle your worker process if you change the values and as I said, use them at your own risk.