Hi,

When purging the frontpage (e.g, without pathname) there is an extra slash at the end of the path. So for example, instead of purging http://mysitetest.devcloud.acquia-sites.com/fi, it tries to purge http://mysitetest.devcloud.acquia-sites.com/fi/ instead. This is wrong because normally there is no extra slash at the end of the path and therefore the expected path is still served from cache. I attached a simple patch for this.

CommentFileSizeAuthor
acquia-purge-extra-slash.patch640 bytesngocketit

Comments

nielsvm’s picture

Status: Active » Closed (fixed)

Hi ngocketit,

I tried testing this on the 7.x-1.x branch but honestly, my behavior was not the same as yours:

$ drush ap-purge /fi
Purged: http://mysite.com/fi
$ drush ap-purge /fi/
Purged: http://mysite.com/fi

But, there's something wrong here indeed as Acquia Purge - which is both API + expire glue - should in fact not strip that ending /, because it still is a valid URL. Varnish will cache http://mysite.com/fi and http://mysite.com/fi/ as two different objects so purging the latter should not lead in a purge to the first URL.

As my current code was already stripping that - as seen above - I decided to strip this out of the core API's _acquia_purge_input_clean() function, which now does all the generic input cleaning. So with that change you can now in fact purge two different URLs exactly as you are giving them:

$ drush ap-purge /fi
Purged: http://mysite.com/fi
$ drush ap-purge /fi/
Purged: http://mysite.com/fi/

But to accommodate your problem described above, it will now right-strip slashes when they originate from the Expire module as Drupal generated links will never refer to paths with slashes on the end so whenever Expire would provide us one to purge, we can safely remove it. The following example illustrates the new behavior (notice that expire-path is provided by Expire itself):

$ drush expire-path /foo
$ drush expire-path /bar/
nvmourik ~/www/ap7 (master *)$ drush ap-process
Purged: http://mysite.com/foo
Purged: http://mysite.com/bar

As you can see, the ending slash is gone here, so to answer your first sentence:

When purging the frontpage (e.g, without pathname) there is an extra slash at the end of the path.

From version 7.x-1.0 - that's due for release in 1-2 weeks - it will still purge that outer slash if you are using drush ap-purge, the rule action 'Purge a path from Varnish on Acquia Cloud' or the Acquia Purge API function acquia_purge_purge_paths() directly. But it will strip that slash if it comes through expire.

[7.x-1.x dca17d5] 2295741: Specifically trim ending slashes on paths originating from expire but don't do that rtrimming in our core API (drush ap-purge, rule action).
 1 file changed, 9 insertions(+), 3 deletions(-)
nielsvm’s picture

Please see https://www.drupal.org/node/2322017#comment-9101035, which is a new (+related) feature that ends up in the module as well.