You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Anthony Biacco <ab...@handll.com> on 2016/08/09 07:03:33 UTC

[users@httpd] getting disk cache to respect removing key from request query string

I'm using apache 2.4.23 under CentOS.
I have requests that are coming into apache that look like:

/path?key1=value&key2=value

I'm trying to remove the key1 parameter and value from the query string
(such that it would be /path?key2=value)
I managed to do this with a modified rewrite example form the apache wiki:

RewriteCond %{QUERY_STRING} (.*)(?:^|&)key1=(?:[^&]*)((?:&|$).*)
RewriteCond %1%2 (^|&)([^&].*|$)
RewriteRule ^(/path)$ $1?%2 [P]

I use [P] because /path is a webapp path that gets forwarded to tomcat with
ProxyPass. Without it, i'll get a 404, which is understandable.

My problem is, i also have a disk cache enabled on /path, so when i use the
above rewrite rule, even though the query string is rewritten correctly, in
the cache header files, i see that the original query string is in there
and used to created a cache file, i.e. creating different cache files for
different values of key1 instead of just for key2.

Is there any way i can rewrite the query string so that only the modified
query string is used to create the cache files?
The only way i found so far is to do a redirect in the rewrite rule with
[R]. I just don't want the extra overhead that goes along with that.

Thanks,

-Tony

Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Aug 10, 2016 at 6:31 AM, Anthony Biacco <ab...@handll.com> wrote:
>
> On Tue, Aug 9, 2016 at 4:47 PM, Eric Covener <co...@gmail.com> wrote:
>>
>> On Tue, Aug 9, 2016 at 3:03 AM, Anthony Biacco <ab...@handll.com> wrote:
>> > The only way i found so far is to do a redirect in the rewrite rule with
>> > [R]. I just don't want the extra overhead that goes along with that.
>>
>>
>> maybe [PT] + what Yann suggested.
>>
>
> [PT] allowed it to go through like [P], but CacheQuickHandler Off (i did
> have it set to On initially) made no difference. Still separate cache files.
> To make it a little simpler, i tried the parameter removal on a static file
> instead of a proxied url. No difference.

Could you please provide some TRACE5 level logs of the transaction?

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Anthony Biacco <ab...@handll.com>.
On Tue, Aug 9, 2016 at 4:47 PM, Eric Covener <co...@gmail.com> wrote:

> On Tue, Aug 9, 2016 at 3:03 AM, Anthony Biacco <ab...@handll.com> wrote:
> > The only way i found so far is to do a redirect in the rewrite rule with
> > [R]. I just don't want the extra overhead that goes along with that.
>
>
> maybe [PT] + what Yann suggested.
>
>
[PT] allowed it to go through like [P], but CacheQuickHandler Off (i did
have it set to On initially) made no difference. Still separate cache files.
To make it a little simpler, i tried the parameter removal on a static file
instead of a proxied url. No difference.

-Tony


> --
> Eric Covener
> covener@gmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Eric Covener <co...@gmail.com>.
On Tue, Aug 9, 2016 at 3:03 AM, Anthony Biacco <ab...@handll.com> wrote:
> The only way i found so far is to do a redirect in the rewrite rule with
> [R]. I just don't want the extra overhead that goes along with that.


maybe [PT] + what Yann suggested.

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Yann Ylavic <yl...@gmail.com>.
On Tue, Aug 9, 2016 at 9:03 AM, Anthony Biacco <ab...@handll.com> wrote:
>
> Is there any way i can rewrite the query string so that only the modified
> query string is used to create the cache files?

Maybe you could try to delay mod_cache processing by using:
   CacheQuickHandler off

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Anthony Biacco <ab...@handll.com>.
On Wed, Aug 10, 2016 at 11:13 AM, Yann Ylavic <yl...@gmail.com> wrote:

> On Wed, Aug 10, 2016 at 5:12 PM, Raphaël <ra...@gmail.com> wrote:
> > On Tue, Aug 09, 2016 at 01:03:33AM -0600, Anthony Biacco wrote:
> >> Is there any way i can rewrite the query string so that only the
> modified
> >> query string is used to create the cache files?
> >
> > https://bz.apache.org/bugzilla/show_bug.cgi?id=21935
> >
> > I was beaten more than once by this issue.
>
> Patch proposed on bugzilla (link above), could you and/or Tony please test
> it?
>
>
>
With the quick handler off, this seems to work fine so far.

-Tony


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Raphaël <ra...@gmail.com>.
On Wed, Aug 10, 2016 at 07:13:05PM +0200, Yann Ylavic wrote:
> On Wed, Aug 10, 2016 at 5:12 PM, Raphal <ra...@gmail.com> wrote:
> > On Tue, Aug 09, 2016 at 01:03:33AM -0600, Anthony Biacco wrote:
> >> Is there any way i can rewrite the query string so that only the modified
> >> query string is used to create the cache files?
> >
> > https://bz.apache.org/bugzilla/show_bug.cgi?id=21935
> 
> Patch proposed on bugzilla (link above), could you and/or Tony please test it?

Tested using patched 2.4.10 Debian Jessie's sources: it works!
(I posted a vhost sample in BZ)

Note that mod_cache verbose logging still log the wrong (unparsed) keys.

Thank you very much Yann!
I'll be happy to see this land in the next 2.4

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Anthony Biacco <ab...@handll.com>.
On Wed, Aug 10, 2016 at 11:13 AM, Yann Ylavic <yl...@gmail.com> wrote:

> On Wed, Aug 10, 2016 at 5:12 PM, Raphaël <ra...@gmail.com> wrote:
> > On Tue, Aug 09, 2016 at 01:03:33AM -0600, Anthony Biacco wrote:
> >> Is there any way i can rewrite the query string so that only the
> modified
> >> query string is used to create the cache files?
> >
> > https://bz.apache.org/bugzilla/show_bug.cgi?id=21935
> >
> > I was beaten more than once by this issue.
>
> Patch proposed on bugzilla (link above), could you and/or Tony please test
> it?
>
>
Roger, i'll give it a go and report back. Much appreciated

-Tony

Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Yann Ylavic <yl...@gmail.com>.
On Wed, Aug 10, 2016 at 5:12 PM, Raphaël <ra...@gmail.com> wrote:
> On Tue, Aug 09, 2016 at 01:03:33AM -0600, Anthony Biacco wrote:
>> Is there any way i can rewrite the query string so that only the modified
>> query string is used to create the cache files?
>
> https://bz.apache.org/bugzilla/show_bug.cgi?id=21935
>
> I was beaten more than once by this issue.

Patch proposed on bugzilla (link above), could you and/or Tony please test it?

Regards,
Yann.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] getting disk cache to respect removing key from request query string

Posted by Raphaël <ra...@gmail.com>.
On Tue, Aug 09, 2016 at 01:03:33AM -0600, Anthony Biacco wrote:
> Is there any way i can rewrite the query string so that only the modified
> query string is used to create the cache files?

https://bz.apache.org/bugzilla/show_bug.cgi?id=21935

I was beaten more than once by this issue.

I ended up using a virtual host, for this sole purpose, where rewrite
rules apply and then proxy to the mod_cache-enabled backend virtual-host.

I'd be more than happy to encounter another solution:
In the current workaround setup I gain nothing from using an
Apache-integrated module rather than using another dedicated
reverse-proxy software.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org