Rewrites overriding "Cache-Control" header

Helicon Ape provides support for Apache .htacces and .htpasswd configuration files for Microsoft IIS.
User avatar
Posts: 2
Joined: 31 Mar 2015, 10:26

Rewrites overriding "Cache-Control" header

31 Mar 2015, 10:35

We're got a .htaccess file running on a .NET site with numerous RewriteRule entries in, which is working fine for the rewrites and redirects, but it's also always setting the "Cache-Control" header of every request to "private".

I've got the appropriate statement in my web.config file:
<clientCache cacheControlMaxAge="365.00:00:00" cacheControlMode="UseMaxAge" />

I've also tried adding the mod_expires module to the .htaccess file:
ExpiresActive On
ExpiresByType text/css "access plus 1 year"

Or trying to force Ape to not touch the Expiry:
ExpiresActive Off

... but no matter what combination, the response always has a private cache with no expiration e.g.
Accept-Ranges:bytes
Cache-Control:private
Content-Encoding:gzip
Content-Length:36338
Content-Type:text/css
Date:Tue, 31 Mar 2015 13:24:22 GMT
ETag:"1f28fd9ea26bd01:0"
Last-Modified:Tue, 31 Mar 2015 11:05:39 GMT
Vary:Accept-Encoding

I'd like it so Helicon Ape doesn't touch anything to do with the Cache and let IIS handle it, is that possible?

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rewrites overriding "Cache-Control" header

31 Mar 2015, 13:50

Hello, Chris

Please consider commenting out the cache-related modules in httpd.conf file: mod_cache, mod_headers, mod_expires.

User avatar
Posts: 2
Joined: 31 Mar 2015, 10:26

Re: Rewrites overriding "Cache-Control" header

01 Apr 2015, 07:02

Still no joy, my httpd.conf looks as follows now, after commenting out the not needed lines as suggested:
Code: Select all
# Helicon Ape version 3.0.0.76

# Helicon Ape core configuration

#Automatically generated license file
Include licenses.conf

##----------------------------------------------------------------------
##
## The following code enables most detailed logging for Ape
##

#Loglevel debug
#ErrorLog error.log

#force Ape to ignore syntax errors in config
Options -StopOnError

##----------------------------------------------------------------------
##
## Read more about supported modules here http://www.helicontech.com/ape/doc/overview.htm
##

LoadModule authz_host_module     modules/mod_authz_host.so
LoadModule auth_basic_module    modules/mod_auth_basic.so
LoadModule auth_digest_module   modules/mod_auth_digest.so
LoadModule authn_dbd_module     modules/mod_authn_dbd.so
LoadModule authn_file_module    modules/mod_authn_file.so
LoadModule authn_anon_module    modules/mod_authn_anon.so
LoadModule authn_default_module modules/mod_authn_default.so
LoadModule authz_user_module    modules/mod_authz_user.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_default_module modules/mod_authz_default.so
#LoadModule asis_module      modules/mod_asis.so
#LoadModule cache_module          modules/mod_cache.so
#LoadModule dbd_module      modules/mod_dbd.so
#LoadModule dbd_exec_module   modules/mod_dbd_exec.so
#LoadModule dir_module        modules/mod_dir.so
#LoadModule disk_cache_module    modules/mod_mem_cache.so
#LoadModule developer_module       modules/mod_developer.so
#LoadModule env_module           modules/mod_env.so
#LoadModule expires_module       modules/mod_expires.so
#LoadModule filter_module    modules/mod_filter.so
#LoadModule gzip_module           modules/mod_gzip.so
#LoadModule headers_module       modules/mod_headers.so
#LoadModule hotlink_module   modules/mod_hotlink.so
#LoadModule linkfreeze_module   modules/mod_linkfreeze.so
LoadModule log_config_module   modules/mod_log_config.so
#LoadModule logio_module      modules/mod_logio.so
#LoadModule mem_cache_module   modules/mod_mem_cache.so
#LoadModule mime_module      modules/mod_mime.so
#LoadModule proxy_module         modules/mod_proxy.so
LoadModule rewrite_module       modules/mod_rewrite.so
LoadModule replace_module      modules/mod_replace.so
#LoadModule usertrack_module   modules/mod_usertrack.so
#LoadModule setenvif_module      modules/mod_setenvif.so
#LoadModule speling_module       modules/mod_speling.so
#LoadModule seo_module       modules/mod_seo.so
#LoadModule xsendfile_module       modules/mod_xsendfile.so


I tried restarting the application pool, IIS server and the whole machine, but still get the following on my requests to all static content "Cache-Control: private":
Code: Select all
Accept-Ranges:bytes
Cache-Control:private
Content-Encoding:gzip
Content-Length:36338
Content-Type:text/css
Date:Wed, 01 Apr 2015 09:54:10 GMT
ETag:"1f28fd9ea26bd01:0"
Last-Modified:Tue, 31 Mar 2015 11:05:39 GMT
Server:Microsoft-IIS/7.5
Vary:Accept-Encoding
X-Powered-By:ASP.NET


Also the .htaccess of the specific site is enabling "AuthType Basic" and "RewriteEngine On" before a long list of redirects. Removing the .htaccess file from the directory and I get the correct Cache:
Code: Select all
Accept-Ranges:bytes
Cache-Control:max-age=31536000
Content-Encoding:gzip
Content-Length:26645
Content-Type:text/css
Date:Wed, 01 Apr 2015 10:01:19 GMT
ETag:"803fd9ea26bd01:0"
Last-Modified:Tue, 31 Mar 2015 11:05:39 GMT
Server:Microsoft-IIS/7.5
Vary:Accept-Encoding
X-Powered-By:ASP.NET

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: Rewrites overriding "Cache-Control" header

06 Apr 2015, 16:29

Hello Chris,

Could you please enable Failed request tracing tool in IIS and make some test request for which caching headers are altered and send me the resulting log to [email protected] with reference to this forum thread.

Please send both .xml and .xsl files.

Return to Helicon Ape

Who is online

Users browsing this forum: No registered users and 30 guests