Support » Plugin: Ads.txt Manager » Cache-bust Issue

  • Hi there!

    This plugin works great. Just one small request:

    Some crawlers of ads.txt will cache-bust to ensure the latest file is requested (e.g. https://example.com/ads.txt?t=2832438293029). However, your plugin always returns a 404 when any query string is added.

    Perhaps the following change in ads-txt.php would fix things:

    from:
    $request = esc_url_raw( $_SERVER['REQUEST_URI'] );

    to:
    $request = esc_url_raw(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

    Thanks!
    -EmbedPlus Team

    • This topic was modified 2 years, 1 month ago by embedplus.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Helen Hou-Sandi

    (@helen)

    4.0 and 4.7 Release Lead

    Hi @embedplus! Thanks for the report. I’ve created a GitHub issue for tracking here: https://github.com/10up/ads-txt/issues/26

    Do you have any info on specific crawlers that do this? I’m not against fixing this at all, I would just like better understanding of why they do this and if they fall back to the non-query string URL at all.

    Hi Helen,

    Thanks for the reply! Imagine though, what happens after somebody updates ads.txt. You’re right, any requester would/should recheck without the query string as a fallback. But the issue is not necessarily the 404. It’s the risk that the fallback mechanism (i.e. no query string) for any requester could retrieve a stale/incorrect version of ads.txt.

    That risk is higher with aggressive caching plugins or if someone fronts their site with Cloudflare or Fast.ly Cache etc., which is fairly common these days. In either case, the request might never hit your plugin’s function again until the cached version somehow eventually expires on its own. The query string simply ensures ads.txt requests can reach your plugin’s latest output in all these situations.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cache-bust Issue’ is closed to new replies.