Hi,
Can you post the script include for the automatic amp plugin that is being rewritten incorrectly?
Thanks,
John
hi, the source code shows this:
<script src=”//cdn.ampproject.org/v0.js” async></script>
i believe that script needs to be loaded over https, and it’s not.
a few other people seem to be having this same problem:
https://wordpress.org/support/topic/amp-validation-had-errors
Hi,
// without http or https will force the link to load over whatever protocol is used to load the webpage its included on. So if the script needs to load over https you need to load your blog over https as well.
Thanks,
John
The script is loading over HTTPS when the “HTTPS Protocol Rewriting” is turned OFF on the Cloudflare plugin.
I turned it to off, and reloaded the page, and this is what I see now:
<script src=”https://cdn.ampproject.org/v0.js” async></script>
however, turning that rewrite off screws up my https pages layout.
Any idea how I can get the “HTTPS Protocol Rewriting” to not strip that https of a script if loaded over http?
This isn’t how the feature is supposed to work. It exists to help prevent mixed content warnings. Not stripping https if its loaded over http is considered insecure and will trigger one of these warnings.
One possible solution is to set up a page rule on CloudFlare to force all requests to your blog to occur over https:
https://support.cloudflare.com/hc/en-us/articles/200170536-How-do-I-redirect-all-visitors-to-HTTPS-SSL-
Thanks,
John
The problem with AMP validation is that CloudFlare’s HTTPS rewriting is turning http:// links into protocol relative // links. AMP requires a affirmative https:// declaration.
I’m not saying the debate is over, but increasingly // is considered and anti-pattern and discouraged. http://www.paulirish.com/2010/the-protocol-relative-url/
CloudFlare should adopt the declarative https:// as is best practice, or make that the default with an option to use a protocol relative method.