Is it possible to add a random variable to the querystring using mod-rewrite

apache-2.2cachemod-rewritePROXY

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?

Thanks!

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!

Best Answer

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?