I'm not sure if this is an issue with the Purge module or the Expire module but the Purge module seems to expect that the path passed to it already begins with a slash when it concatenates the purge_url for a request. So, if Expire expires "/my/path", Purge tries to purge "http://localhost:80/my/path" (which is correct) but if Expire expires "my/path", Purge crafts in invalid url to make a purge request: "http://localhost:80my/path". It seems that we can oops-proof this with Purge.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | purge-7x1x-1886546-8-vs-7.interdiff.txt | 2.36 KB | donquixote |
| #8 | purge-7x1x-1886546-8-prepend-missing-slash-and-use-base-url.patch | 2.91 KB | donquixote |
Comments
Comment #1
squaretone commentedI have attached the beginning of a patch that trims off any beginning "/" from the $purge_path and re-adds it manually as part of the concatenation. The caveats are that I only affected instances of "purge" methods and not "get" or "ah" (Acquia Hosting) and I only tested it on Varnish and not Squid or Nginx. Also, this patched is rolled against the 6.x branch.
Comment #2
heddnNot sure if this applies, but this sounds a lot like #1471926: Invalid expire URLs when "Include base URL in expires" is enabled.
Comment #3
squaretone commentedPerhaps they are related. In my case, I was experiencing the issue whether the "Include base URL in expires" checkbox was checked or not.
Comment #4
SqyD commentedThis is indeed the effects of the Expire issue #1471926: Invalid expire URLs when "Include base URL in expires" is enabled.. Thanks for reporting anyhow. Reminds me I should take advantage of my co-maintainership of that module sometime soon and fix it.
Comment #4.0
SqyD commentedmoving patch description to my next comment where I will attach the patch.
Comment #5
donquixote commentedThis does not seem to be fixed at all.
Expire module sends paths without a trailing slash, if expire_include_base_url is disabled.
Purge module constructs a url from proxy base and purge path, where the slash is missing, if the proxy url is a domain without a path.
There is nothing here that would guarantee that the slash is present.
The linked issue in expire has a commit 09c033fbb07babcab5200bd78049b592caf6aa51, which modifies a function expire_cache_derivative() which does not even exist anymore.
Also, it talks about the case where "Include base URL in expires" is enabled. I had this problem when it is disabled.
I think one main problem is that hook_expire_cache() does not document if relative urls will be with or without trailing slash.
The same applies for other pieces of code.
Comment #6
donquixote commentedOh, I see now this was a 6.x-1.x issue!
Anyway, it still applies, and I don't think we need to open a new issue. The description is still quite accurate.
Comment #7
donquixote commentedI think I found the easiest way to fix this: Normalize the array from parse_url() so that $purge_url_parts['path'] always starts with a slash if not empty.
Note that this only solves a very specific problem.
Remaining problems not fixed here:
Comment #8
donquixote commentedI think better to fix this and #1474876: Error Messages "Notice: Undefined index: host in purge_urls() (line 27 of [...]modules/purge/purge.inc)" being displayed in one go.
Note: Perhaps it would be easier to call
$purge_url_parts = parse_url(url($purge_url)).But this would also do alias lookup, invoke rewrite hooks, and possibly more. Also it would not prepend anything to paths starting with slash.
I think the patch is closer to the existing behavior.
Comment #9
japerry