• Resolved Tim

    (@tjalexander70)


    I have been using and evaluating AMP for about a month and have a generally positive opinion.

    However, there is an issue with using /?amp vs /amp/ in URLs. I can’t find it now, but there was a support thread I found a while back talking about /amp/ being depreciated because some websites may use “amp” as a category or tag, and that could cause some issues.

    The problem that I have seen is this does not work with Cloudflare’s “Automatic Platform Optimization for WordPress”, which uses Cloudflare’s cache to serve a static version of a site without interference… basically, if I update something, or a visitor adds a comment, Cloudflare automatically knows (via its plugin) to update that post or page.

    However, since the AMP plugin uses a query string to identify amp pages, Cloudflare’s cache does not store a static version for AMP… at least, not automatically. I brought this up on the Cloudflare Support Forum last month: https://community.cloudflare.com/t/apo-and-amp-pages/227717

    The workaround has been to create a Page Rule that essentially states if https://example-website/*/?amp* then Cache Everything. It should be noted that I can create a Page Rule using Cache Everything because I am using a paid version of Cloudflare. This limited solution is not available to Cloudflare’s free users.

    Additionally, using Cloudflare’s Page Rule means that any time there is a post change or visitor comments (and you can’t really be on top of that 24/7), someone has to go into Cloudflare and manually purge the cache for that page. Cloudflare’s “Automatic Platform Optimization for WordPress” also recognizes WordPress cookies and knows when to serve a cached version of the website or a live version. That does not work if a page is under a Cache Everything rule.

    I apologize for the longwinded post but the issue of using a query string rather than having amp within the actual path has become a big problem since the largest portion of my traffic is visiting the AMP version of posts.

    I don’t know what percentage of AMP plugin users are also Cloudflare users, but I am kinda surprised this problem has not come up more often.

    It seems the only thing that can fix this is giving websites the option between using query string and path. Does that make sense?

    • This topic was modified 3 years, 10 months ago by Tim.
    • This topic was modified 3 years, 10 months ago by Tim.
Viewing 15 replies - 1 through 15 (of 24 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    Thanks for the topic.

    It turns out that you are in luck. I’m in fact working on a pull request that allows you to customize the paired URL structure, including allowing you to choose between /amp/ and ?amp=1 (and ?amp).

    We did intend to deprecate /amp/ in favor of the query parameter, but we’ve since decided against it since many users request it. So we’re instead just defaulting to ?amp=1 for new installs.

    If you’d be willing to test the pre-release build of this feature it would be quite helpful. You can find a production build ZIP linked in this comment: https://github.com/ampproject/amp-wp/pull/5558#issuecomment-725867606

    Thread Starter Tim

    (@tjalexander70)

    Sweet! I don’t know if I am that technically savvy. It is amazing how much I can do with very little knowledge. All I need to do is upload the zip file, right?

    Plugin Author Weston Ruter

    (@westonruter)

    Yes, all you do is download that amp.zip file linked to from that comment and then follow the instructions here, which are standard for adding any plugin from a ZIP file: https://github.com/ampproject/amp-wp/wiki/Development-Builds#installation-instructions

    Upon installation, you should see the installed plugin version is 2.1-alpha followed by the date and a revision.

    • This reply was modified 3 years, 10 months ago by Weston Ruter.
    Thread Starter Tim

    (@tjalexander70)

    Great! Let me give it a test drive and I’ll be back in 24-48 hours… sooner if it crashes the site. lol

    Thread Starter Tim

    (@tjalexander70)

    Ok…. right off the bat, I am not seeing the “Paired URL Structure” section in the Settings page.

    Plugin Author Weston Ruter

    (@westonruter)

    On the Plugins screen, what does it show the version is for the AMP plugin?

    What template mode are you using? The section only shows up for Reader or Transitional. It is irrelevant in Standard mode since it is not a paired AMP mode.

    • This reply was modified 3 years, 10 months ago by Weston Ruter.
    Thread Starter Tim

    (@tjalexander70)

    Version 2.1.0-alpha-20210115T011313Z-d9add69

    I am using Reader.

    Also, it is reporting a number of plugins with errors that worked before, including Ad Inserter, which I need.

    Plugin Author Weston Ruter

    (@westonruter)

    You should see the version is 2.1.0-alpha-20210114T185312Z-dff8534:

    Then on the AMP settings screen I see:

    The Paired URL Structure section is at the bottom.

    • This reply was modified 3 years, 10 months ago by Weston Ruter.
    Plugin Author Weston Ruter

    (@westonruter)

    Make sure you downloaded the production build from this location: https://github.com/ampproject/amp-wp/pull/5558#issuecomment-725867606

    Plugin Author Weston Ruter

    (@westonruter)

    You downloaded the wrong ZIP file. The one you downloaded is the latest from the develop branch for all merged pull requests. You need rather to download the ZIP for the yet-unmerged pull request: https://github.com/ampproject/amp-wp/pull/5558#issuecomment-725867606

    • This reply was modified 3 years, 10 months ago by Weston Ruter.
    Plugin Author Weston Ruter

    (@westonruter)

    Also, it is reporting a number of plugins with errors that worked before, including Ad Inserter, which I need.

    This shouldn’t be anything new as of this new build. It’s just that they hadn’t been detected yet.

    Plugin Author Weston Ruter

    (@westonruter)

    In any case, if you can share a screenshot of the errors that it is reporting, that would be helpful.

    Thread Starter Tim

    (@tjalexander70)

    Now having trouble with adding the correct one… WordPress is not overwriting and created amp-1 directory.

    Plugin Author Weston Ruter

    (@westonruter)

    Ugh, that’s annoying. I’ve had that problem once before when uploading a plugin into WordPress. Two things you may need to do:

    1. Uninstall the plugin entirely.
    2. Delete amp.zip from wp-content/uploads/2021/01/ if that is still there.
    3. Re-install.

    • This reply was modified 3 years, 10 months ago by Weston Ruter.
    Thread Starter Tim

    (@tjalexander70)

    I got it… the “Paired URL Structure” section is there and the plugin issues are gone.

Viewing 15 replies - 1 through 15 (of 24 total)
  • The topic ‘AMP and Cloudflare’ is closed to new replies.