Problem/Motivation

When the URL of a website's homepage is https://www.example.com/en, a URL not beginning with that cannot be cleared because the check for internal paths uses the homepage url rather than base url:

protected static function addInternalPaths($absolute_urls) {

    $urls = array();
    $base_path = url('<front>', array('absolute' => TRUE));

in includes/expire.api.inc

Proposed resolution

Use $base_url instead.

Patch to follow shortly.

Comments

scott_euser created an issue. See original summary.

scott_euser’s picture

Proposed patch attached.

scott_euser’s picture

Status: Active » Needs review
fgjohnson@lojoh.ca’s picture

Hi Scott,

We use Varnish, Expire and memcache and have a similar issue perhaps.
Is this what you were trying to fix?

Basically when we select (recommended) the "Include base URL"; appropriate relative links get generated to expire (we can see in watchdog)... but nothing is actually expiring.

BUT if we enable "Include base URL" (not recommended) the full URL to the nid, and pathauto URL, of updated node is sent and expires correctly.

However - We are a multilingual site and we use custom URL's also for generated pages.... and the "Full path" generated in the "enabled" case includes the extra /en which is my home page.

alerts becomes https://my.site.com/en/alerts
en/alerts becomes https://my.site.com/en/en/alerts
fr/alerts becomes https://my.site.com/en/fr/alerts

I will try your patch and see what the effects are.

fgjohnson@lojoh.ca’s picture

FTY - The patch should reside in the root of the expire module not in docroot.

scott_euser’s picture

Ah apologies for that - was an old project using mercurial so the diff went from the root instead of project; sorted attached.

In our case it is similar but, the homepage of the website is like https://www.example.com/en (ie, ) and a stylesheet we are trying to expire on gulp compile is like https://www.example.com/sites/all/themes/our-theme/assets/css/style.min.css. Without the patch, the module automatically attempts to expire https://www.example.com/en/sites/all/themes/our-theme/assets/css/style.m... instead. Same problem with custom hook_menu() routes used for various callbacks + rest API routes.

Relying on $base_url set by core instead should be a more accurate reflection of the domain.