wpsharks / comet-cache

An advanced WordPress® caching plugin inspired by simplicity.
https://cometcache.com
GNU General Public License v3.0
77 stars 18 forks source link

Use CDN for Pro version checks and improve proxy fallback #879

Open raamdev opened 7 years ago

raamdev commented 7 years ago

Note: This issue is currently blocked by changes needed to the build system: https://github.com/websharks/phings/issues/159.


Once the above issue has been closed, the Comet Cache Pro update utilities can be updated to check https://cdn.wpsharks.com/software/bleeding-edge/comet-cache-pro/version.txt for the latest Pro version, instead of querying the API on cometcache.com.

Additionally, we might be able to do away with using the proxy server fallback for version checks on servers that have older SSL software that doesn't support HSTS headers:

@jaswrks writes...

You could try dropping the proxy fallback by running this particular request over http:// instead of https://. Since we are changing the request type from POST to GET, and because it's now a static file containing only a version, it's not necessary for us to use SSL in this particular case.

_Note: If you try to reach http://cdn.wpsharks.com/software/latest/comet-cache-pro/version.txt in a web browser, you'll be redirected to the https:// variation, which is enforced due to HSTS headers. However, in a server-side wp_remote_get() implementation, you should be able to query via http:// without a problem. HSTS is not a factor there. However, it might be worth checking to see if WPHttp has any setting that would force HSTS off, just in case that's possible. I'm doubt that it is. WordPress would need to have code that looks for a strict transport header and obey it, which I don't believe it even looks at right now.

That said, we should still use SSL when performing license key authentication.

TODO

jaswrks commented 7 years ago

New proxy URL: http://update-fallback.wpsharks.io/cc-proxy

?product_api[action]=latest_pro_update &product_api[username]=johndoe22 &product_api[password]=[COMET CACHE API KEY] &product_api[stable]=1 (stable releases, or any release?)

In short, all the same variables that cometcache.com uses. This is simply a non-SSL proxy.

Returns JSON, just like cometcache.com does.

{
  "pro_version": "170220",
  "pro_zip": "http://dls.wpsharks.io/cdn-xar?slug=comet-cache-pro&version=170220&expires=1494021828&_sig=6ee774...3f445118ffb0beccf52e65b0826856bca40"
}
jaswrks commented 7 years ago

Another new proxy URL: http://dls.wpsharks.io/cdn-xar

?slug=comet-cache-pro &version=[COMET CACHE VERSION] &expires=[TIMESTAMP EXPIRATION] &_sig=[REQUIRES SECRET KEY TO SIGN THE REQUEST]

URLs leading to this endpoint are generated by the cometcache.com API and the new update-fallback.wpsharks.io/cc-proxy endpoint noted in the previous comment above ↑

In other words, all Comet Cache automatic updates now pass through http://dls.wpsharks.io/cdn-xar (non-SSL), which is what delivers the zip file downloads.

jaswrks commented 7 years ago

Documented the new API endpoints above ↑

jaswrks commented 7 years ago

The list above has been completed and this is now pending a PR review. https://github.com/websharks/comet-cache-pro/pull/315