cloudflare / Cloudflare-WordPress

A Cloudflare plugin for WordPress
https://www.cloudflare.com/wordpress/
BSD 3-Clause "New" or "Revised" License
208 stars 84 forks source link

How does cloudflare detect the plugin is installed? #513

Closed peixotorms closed 2 months ago

peixotorms commented 1 year ago

Confirmation

WordPress version

6.2

Cloudflare-WordPress version

4.1.2.0

PHP version

8.1

Expected result

N/A

Actual result

N/A

Steps to reproduce

When I go to Cloudflare and want to enable APO, it says the Cloudflare plugin is not detected or installed. After installing it, it starts detecting it and I can install it.

However, I want to use the Cloudflare API with custom PHP coding, so I don't need the plugin to be installed. How do I make it so that Cloudflare thinks that the Cloudflare plugin is installed?

Is it some api call, some html markup, or something else?

Thanks

Additional factoids

N/A

References

N/A

markjaquith commented 9 months ago

The plugin tells WordPress to add an HTTP header:

cf-edge-cache: cache,platform=wordpress (if the response should use the cache)

or

cf-edge-cache: no-cache (if the response should not use the cache)

https://github.com/cloudflare/Cloudflare-WordPress/blob/4ad24c88c9a1ed58b2aa288ce3ca587ba873566c/src/WordPress/Hooks.php#L436-L442

I suspect that when enabling APO on the Cloudflare side it just looks for this cf-edge-cache header to be present and have an expected value.

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.