We're having a very odd problem with a proxy that a client uses.

In short, their proxy is caching information that it should not be caching. We have the appropriate information in the header that tells the proxy server not to cache AND it's over SSL, but it's still happening.

I can prevent this / remedy this by appending a random variable to the end of their querystring in the URL.

For example:

/information.php may show cached information, whereas /information.php?randomvariable=12345 will not.

Is there a mod rewrite rule that will accommodate something like this?


Edit -

Per Squillman's request, here's the meta data that we send for caching (I misspoke, it's metadata, not HTTP header information):

<meta http-equiv="CACHE-CONTROL" CONTENT="NO-CACHE">
<meta http-equiv="PRAGMA" CONTENT="NO-CACHE">
<meta http-equiv="Expires" content="Mon, 26 Jul 1997 05:00:00 GMT"/>
<meta http-equiv="Pragma" content="no-cache" />

Hope this helps! Thanks.

Edit 2 -

I've implemented a fix at the application level. I append a random variable (seed=random md5) to the query string for each request. It's dirty -- but it works.

I'll post an update once I figure out why this problem is happening. Thanks for the responses!

  • Just for the sake of argument, can you post the headers you're sending to the client?
    – squillman
    Feb 26 '10 at 18:54

Couple of questions:

  • Are you sure that it's the proxy that's doing the caching?
  • If so, what have you done to confirm that?
  • Do you know what proxy product the client is using?

The fact that it's going over SSL means that the proxy should not cache it, period (sorry, missed the SSL bit before I posted my comment). If it's a big name proxy product, then I'd more suspect that it's really the clients misbehaving.

I'm not sure if it's possible in mod_rewrite. Couldn't you just generate it from within PHP?

  • The idea that it's a proxy that's causing the problem comes from the client. They stated that they had just implemented a new proxy server and the timing of the issue coincides with their implementation. They have been using our particular product for about a year with no issues, and this certainly would have shown up prior to this. There have been no changes to the product on our end either.. I'm baffled. Thanks again for the info.
    – Ian P
    Feb 26 '10 at 20:18
  • @Ian P - Yeah, I would really question them on the proxy front. Normal proxies should just straight-up NOT be able to get inside a request within SSL.
    – squillman
    Feb 26 '10 at 21:04
  • +1 for SSL and no-cache. I agree in principle with what you say here, but it's becoming ever more common for web filters to have the capability to inspect SSL (via explicit proxy and on-the-fly certificate generation), though I can't think of any that can force caching.
    – fission
    Feb 27 '10 at 6:51

mod_rewrite has a MapType of rnd which may be able to do what you want.

See this page under randomized plain text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.