Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006064 [Resin] minor always 06-22-17 06:15 07-12-17 16:27
Reporter stbu View Status public  
Assigned To ferg
Priority normal Resolution no change required  
Status closed   Product Version 4.0.53
Summary 0006064: Proxy-Cache: "Cache-Control: max-age" Header disappears when (conditional) Redirect Rule is present in web-app
Description We're running Resin-Professional in an environment with multiple virtual hosts, several web-apps and many Rewrite Rules.

While trying to add HTTP Caching configuration again to certain web-apps we have observed a problem that when a Rewrite Rule was present, the Cache-Control: max-age=nnn" header was removed.

It was possible to make a simple test web-app with one .png image that should be cached. Resin will add the proper Header when <proxy-cache> and <cache-mapping> is configured, but once a conditional rewrite rule has been added, it's gone.

The Additional information contains further desriptions on how to reproduce the issue.
Additional Information Steps to reproduce:

- Downloaded Resin Professional 4.0.53
- cd into resin-pro-4.0.53
- Copy our Pro license into resin-pro-4.0.53/licenses
- Added the following line into resin.xml to add the <proxy-cache> within the <cluster id="app">

Here is the diff between the new resin.xml and the original one:
84,86d83
<
< <proxy-cache path="cache-test" memory-size="256M" disk-size="2G" entries="16384" max-entry-size="2M" enable="true" enable-range="true"/>
<

drop test.war (uploaded to this bug-report) into resin-pro-4.0.53/webapps

Run curl on command line to see the headers of a request to the test web-app's /images/logo.png file:

curl -o /dev/null -s -D - http://localhost:8080/test/images/logo.png [^]

HTTP/1.1 200 OK
Server: Resin/4.0.53
ETag: "409sQeD44+m"
Last-Modified: Thu, 22 Jun 2017 12:27:22 GMT
Accept-Ranges: bytes
Cache-Control: max-age=666
Content-Type: image/png
Content-Length: 5964
Date: Thu, 22 Jun 2017 12:34:39 GMT

==> As you can see there is the "Cache-Control: max-age=666" header returned by Caucho Resin 4.0.53


Now, let's make a simple change in the resin-pro-4.0.53/webapps/test/resin-web.xml file and add the following Redirect Rule (just uncomment it in the file)


  <resin:Redirect regexp="^/" target="http://example.com/"> [^]
    <resin:IfCookie name="DummyIsNotSet"/>
  </resin:Redirect>


Restart Resin or the Web-App and then run curl again:

curl -o /dev/null -s -D - http://localhost:8080/test/images/logo.png [^]

HTTP/1.1 200 OK
Server: Resin/4.0.53
Cache-Control: private
ETag: "409sQeD44+m"
Last-Modified: Thu, 22 Jun 2017 12:27:22 GMT
Accept-Ranges: bytes
Content-Type: image/png
Content-Length: 5964
Date: Thu, 22 Jun 2017 12:47:35 GMT

==> Now, the "Cache-Control: max-age=666" is gone, but the "Cache-Control: private". But this is not enough without either "Expire" or "Cache-Control: max-age".
But the resin-web.xml still contains the "<cache-mapping url-pattern="/*.png" max-age="666"/>" and the Rewrite has not fired.
Attached Files  test.war [^] (7,074 bytes) 06-22-17 06:15

- Relationships

- Notes
(0006770)
ferg
07-12-17 16:27

This is normal behavior.

The URL output varies depending on the Cookie header, because of the resin:IfCookie. So, the output can't be cached publicly without a Vary header. (It is cached internally.)

You can enable the public caching headers with a resin:SetVary rule.

  <resin:SetVary regexp="..." value="Cookie"/>
 

- Issue History
Date Modified Username Field Change
06-22-17 06:15 stbu New Issue
06-22-17 06:15 stbu File Added: test.war
06-22-17 06:16 stbu Issue Monitored: stbu
07-12-17 16:27 ferg Note Added: 0006770
07-12-17 16:27 ferg Assigned To  => ferg
07-12-17 16:27 ferg Status new => closed
07-12-17 16:27 ferg Resolution open => no change required


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker