Correct Apache cache keys on rewritten URL's

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Correct Apache cache keys on rewritten URL's

adam.vest
Hello All,

I've been working on this for the past few days, attempting to find a
way to get the Apache mod_disk_cache module to properly store requests
that are rewritten. As I'm sure many of you are aware, it's fairly
common practice these days for modern CMS's to just rewrite everything
to index.php and let that handle things (so-called "pretty urls" or
"permalinks"). However, this rewrite renders Apache's cache useless
because this then means that ALL dynamic requests are cached under the
same "http://domain.com/index.php" key, which would mean that anyone who
would request, say, "http://domain.com/thing2" might get the content of
"http://domain.com/thing1" that is already in the cache.

I've been trying many different approaches to fixing this (from
attempting to detect when/if the URL was rewritten, to attempting to
dynamically set the CacheKeyBaseURL directive), but so far I've been
unable to come up with any way to resolve this issue. I feel like
dynamically setting the "CacheKeyBaseURL" holds the most promise if this
can actually be done, but then again fixing the Apache caching function
to better handle rewritten URI's would be ideal.

Anyone have any thoughts on how I might get this working? Other than
"don't use it" or "use something else" :) - I'd really like to use
Apache cache if possible.

Thanks in advance!

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Correct Apache cache keys on rewritten URL's

adam.vest
As I consider this to be undesirable behavior on the part of the Apache
cache, I went ahead and opened a bug report on this matter about a week
ago:
* https://bz.apache.org/bugzilla/show_bug.cgi?id=63282

I tried sifting through the source code to find where it was defining
the key to see if I could propose a change, but my limited C coding (and
coding in general) was quickly overwhelmed. The change, at least
conceptually, seems simple enough - instead of using the rewritten URI
for the cache key, use the original URI.

On 2019-03-19 12:10, [hidden email] wrote:

> Hello All,
>
> I've been working on this for the past few days, attempting to find a
> way to get the Apache mod_disk_cache module to properly store requests
> that are rewritten. As I'm sure many of you are aware, it's fairly
> common practice these days for modern CMS's to just rewrite everything
> to index.php and let that handle things (so-called "pretty urls" or
> "permalinks"). However, this rewrite renders Apache's cache useless
> because this then means that ALL dynamic requests are cached under the
> same "http://domain.com/index.php" key, which would mean that anyone
> who would request, say, "http://domain.com/thing2" might get the
> content of "http://domain.com/thing1" that is already in the cache.
>
> I've been trying many different approaches to fixing this (from
> attempting to detect when/if the URL was rewritten, to attempting to
> dynamically set the CacheKeyBaseURL directive), but so far I've been
> unable to come up with any way to resolve this issue. I feel like
> dynamically setting the "CacheKeyBaseURL" holds the most promise if
> this can actually be done, but then again fixing the Apache caching
> function to better handle rewritten URI's would be ideal.
>
> Anyone have any thoughts on how I might get this working? Other than
> "don't use it" or "use something else" :) - I'd really like to use
> Apache cache if possible.
>
> Thanks in advance!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]