Bug 60577 - Mod cache not working, with apache set as forward http proxy
Summary: Mod cache not working, with apache set as forward http proxy
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cache (show other bugs)
Version: 2.4.25
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2017-01-12 11:33 UTC by kudlacak1
Modified: 2017-06-25 12:44 UTC (History)
3 users (show)



Attachments
Configuration of httpd (1.30 KB, text/plain)
2017-01-12 11:33 UTC, kudlacak1
Details
Possible patch (491 bytes, patch)
2017-01-12 12:03 UTC, Petr Sumbera
Details | Diff
Another proposed patch (3.05 KB, patch)
2017-01-12 14:13 UTC, Yann Ylavic
Details | Diff
Early vs final URIs used by mod_cache (13.31 KB, patch)
2017-02-20 21:26 UTC, Yann Ylavic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kudlacak1 2017-01-12 11:33:30 UTC
Created attachment 34612 [details]
Configuration of httpd

When apache is set as forward http proxy, CacheEnable disk http://, should cache all http content and it is not working (CacheQuickHandler is Off). It should be caused by this commit: https://github.com/apache/httpd/commit/cc21a5acc79e1d8522373061dd3c2e91487bdc7b by comparing uri and path in file modules/cache/cache_util.c. Complete configuration attached.
Comment 1 Petr Sumbera 2017-01-12 12:03:55 UTC
Created attachment 34613 [details]
Possible patch

We are hiting the same issue with 2.4.25. Attached is patch which seems to resolve the issue (uses the same value as 2.4.23 did).
Comment 2 Jim Jagielski 2017-01-12 13:42:22 UTC
Thanks. Will review.
Comment 3 Yann Ylavic 2017-01-12 14:13:01 UTC
Created attachment 34616 [details]
Another proposed patch

Wouldn't this patch be better?

One might still want to cache based on the rewritten URL, and attachment 34613 [details] reverts that (was the purpose of r1756553).
Comment 4 Petr Sumbera 2017-01-12 14:34:28 UTC
I'm not expert here. I can just confirm that 34616 makes our test case to pass.
Comment 5 Yann Ylavic 2017-02-20 21:26:32 UTC
Created attachment 34770 [details]
Early vs final URIs used by mod_cache

Depending on whether mod_cache runs in forward proxy and quick handler modes, or normal handler mode, its base path and query string references/canonicalizations are not computed at the same time (before or after quick_handler and proxy_detect transforms) and thus may differ.

This patch defines the cache_use_early_url() helper and use it wherever appropriate for mod_cache to consistently refer to the same entity while serving and/or caching the response, in both early and late cases.
Comment 6 Petr Gajdos 2017-02-21 07:17:20 UTC
Hey,

I can confirm, that following example ([2] subexample, forward proxy):

https://github.com/pgajdos/apache-rex/tree/master/mod_proxy-cache

fails before and pass after the patch in comment 5 on the top of 2.4.25.

Thank you!
Comment 7 Yann Ylavic 2017-02-21 08:30:01 UTC
Thanks all for the test(s), committed to trunk (r1783842) and proposed for backport to 2.4.x.
Comment 8 Eric Covener 2017-06-25 12:44:25 UTC
fixed in 2.4.25 with a followup in .26