Skip to content

RequestReduce Configuration options

mwrock edited this page Jul 30, 2011 · 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" connectionStringName="RRConnection" 
 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
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
authorizedUserList A comma delimited list of user names that are authorized to [flush RequestReduce generated files] or [reset the RequestReduce failure limit for failed css processing]. 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
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. Empty
imageOptimizationDisabled Setting this property to true will disable image optimization. RequestReduce uses 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 try decreasing the compression level using te configuration setting below. 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
Clone this wiki locally