Skip to content

RequestReduce Configuration options

mwrock edited this page May 17, 2012 · 21 revisions

RequestReduce provides several configuration properties to customize how RequestReduce behaves. Unconfigured, RequestReduce uses defaults appropriate for a basic single server environment. In order to configure RequestReduce, you must add its configuration section to your web.config's <configSections/>.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="RequestReduce" type="RequestReduce.Configuration.RequestReduceConfigSection, RequestReduce"/>
  </configSections>
</configuration>

With this <section/> element added, you can add the RequestReduce configuration to your config which looks like this:

<RequestReduce spriteVirtualPath="/RRContent" authorizedUserList="anonymous"/>

The example above is not a complete list of the attributes available to the RequestReduce configuration. The table below lists and describes each option as well as its default setting. Keep in mind that these attributes are case sensitive.

Attribute Description Default
spriteVirtualPath This is the virtual path to the location where RequestReduce saves transformed css and sprite files. If you set this to "/content/ReducedResources" then RequestReduce will save all of its generated files to the directory that maps to this path and create image urls that point to that path. If the physical path does not exist, RequestReduce will create it. ~/RequestReduceContent
spritePhysicalPath You should not have to include this option unless you want to save RequestReduce generated files to a physical path that is different from the path that spriteVirtualPath maps to. This can be any valid UNC path either local or remote. Important: The process under which your web site runs must have write privileges to this path. The path that maps to spriteVirtualPath
contentHost This allows you to specify a specific host name used for all RequestReduce urls. You would use this if you employ a CDN or cookieless domain for static content. If you want all your static content to be referenced at http://static.mysite.com, then this attribute would be http://static.mysite.com. Empty
spriteSizeLimit The number of bytes to try and limit the size of generated sprite files. This does not guarantee that the file will not exceed this amount. However, as RequestReduce is adding individual sprite images to a file, once the file's byte count exceeds this threshold, it will save all subsequent images to a new file. 50000
cssProcesingDisabled A boolean flag indicating whether or not the filter should process css files and sprite images. If set to true, the RequestReduce response filter will not attach to the response and the original css will be left in tact. false
authorizedUserList A comma delimited list of user names that are authorized to access and perform actions available on the dashboard. By default, RequestReduce will allow any user to perform these operations. However in a production environment you would not want just anyone to have these rights since they may prompt RequestReduce to reprocess a page's reductions which is a server expensive operation. A malicious user could repeatedly flush your reductions causing RequestReduce to continually reprocess content and increase the CPU usage of your web server. RequestReduce expects the values of these users to map to:
HttpContext.User.Identity.Name
anonymous
ipFilterList A comma delimited list of ip addresses (either IPv4 or IPv6) that are authorized to access and perform actions available on the dashboard. This list is granted the same rights as any user in the authorizedUserList above. none
proxyList A of proxy server IP addresses that are authorized to forward requests on behalf of the users included in the above ipFilterList. If your web server sits behind a load balancer or other proxy, chances are that the IP address that the web server sees is the ip of that proxy and not of the incoming user. However, most proxies advertise the actual user IP in an alternate HTTP header like HTTP_X_FORWARDED_FOR and others. When this setting is used, RequestReduce will check the common forwarding headers for the user ip in the above ipFilter setting as long as the true ip address of the packet is coming from an ip in this list. none
contentStore This will be either LocalDiskStore or SqlServerStore. By default, RequestReduce saves all generated content to disk. This is the simplest option but might not work for [multiple web server environments]. Unless you use a fast multi master file replication solution like rsync or DFS or save to a network share that gets replicated to all web servers, you may want to use the [SqlServerStore] setting. This will save generated files to a sql server connection specified in the ConnectionStringName setting. This has been tested with Sql Server 2008 R2, Sql Server 2008 Express and Sql Server 4 Compact Edition. It will most likely work with other sql server versions as well. You will need to execute the script in RequestReduceFiles.sql which will create the RequestReduceFiles table. Make sure that the process that your website runs with has read/write prviledges to this table. LocalDiskStore
connectionStringName This setting only applies if you are using the [SqlServerStore] contentStore setting. This can be either a full sql server connection string, a reference to a <connectionStrings> name in your web.config or a table name in your local sql server express installation. none
imageOptimizationDisabled Setting this property to true will disable image optimization. RequestReduce uses an image quantization algorithm adapted from Xiaolin Wu's fast optimal color quantizer and OptiPng.exe to compress the size of the background image yet maintain the quality of the rendered image. It is of course recommended that you keep this feature enabled. You should only turn this feature off if you believe that the quality of your images is degrading. However, before disabling image optimization, you should first try decreasing the spriteColorLimit which will increase the number of sprite files but aill likely also increase the quality of your images. You may also disable Quantization (see setting below) without disabling the lossless compression. By disabling quantization and keeping optimization enabled, you will almost certainly continue to realize some optimization with no quality loss. False
imageOptimizationCompressionLevel This setting can be a number between 1 and 7 and specifies the level of compression that you would like RequestReduce to use when optimizing your images. While I have found that 5 (the default) maintains an acceptable balance of quality, compression and processing time, you may want to increase this if you want to try and make the image even leaner. Be aware that as you raise the level above 5, the processing time becomes significantly longer and the potential savings becomes less likely. 5
imageQuantizationDisabled Setting this property to true will disable image quantization. RequestReduce uses an image quantization algorithm adapted from Xiaolin Wu's fast optimal color quantizer to reduce sprites to an 8 bit RGBA Palette in order to potentially significantly reduce the size of the sprite file. Often this will yield file sized up to 3x smaller than an unoptimized image. It is of course recommended that you keep this feature enabled. It is hopefully rare that this process will cause the perceived quality of the image to be impacted. You should only turn this feature off if you believe that the quality of your images is degrading. Even then, you can try decreasing the spriteColorLimit setting (see below) to increase image quality with the compromise of more sprite files. False
spriteColorLimit This setting specifies a limit to the number of colors to include in a single individual sprite file. RequestReduce uses this setting and the spriteSizeLimit seting to determine when it should start putting images in a new master sprite file. By decreasing this setting, RequestReduce will have fewer colors to eliminate from the original image in order to produce its 256 color 8 bit PNG. Likewise, you may increase this number if you find that RequestReduce is creating multiple sprite files and you would like to have fewer requests. While 5000 colors is a safe default, I have changed this to 10000 on my blog which has not affected the quality of my images. 5000
storePollInterval This setting is only used if you use the Sql Store to store your css, javascript and images. This is the number of milliseconds that RequestReduce will wait before polling the database to ensure it has a synced list of reduced stylesheets and scripts. I think 60000 (1 minute) is a safe setting here for a sql install. none
javascriptUrlsToIgnore This is a comma separated list of url substrings that you want RequestReduce to ignore when it comes accross an external script tag to minify and combine. ajax.googleapis.com/ajax/libs/jquery/, ajax.aspnetcdn.com/ajax/jQuery/
javascriptProcesingDisabled If this is true, javascript is not minified or combined. false
imageSpritingDisabled If this is true, images will not be sprited. false
ignoreNearFutureJavascriptDisabled If this is true, RequestReduce will not ignore scripts with a Max-Age or expiration of less than a week. false
Clone this wiki locally