Title: Issues with Worker Template Code
Last modified: February 8, 2024

---

# Issues with Worker Template Code

 *  Resolved [amirhmoradi](https://wordpress.org/support/users/amirhmoradi/)
 * (@amirhmoradi)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/issues-with-worker-template-code/)
 * Hi,
 * I am trying to implement the worker in my CF account as it did not get pushed
   when activating the plugin.
 * I notices multiple errors (mainly type errors) in the code when adding the code
   from `assets/js/worker_template.js` (by copy/pasting) into the CloudFlare worker
   code editor.
 * Also I did a small optimization to the code I think might be useful to integrate:
   
   in the `url_normalize` function, instead of the costly `for` loop, I suggest 
   using:`// Directly iterate over searchParams and delete if found in THIRD_PARTY_QUERY_PARAMETERSTHIRD_PARTY_QUERY_PARAMETERS.
   forEach(param => { if (reqURL.searchParams.has(param)) { reqURL.searchParams.
   delete(param); }});
 * Please have a look into the type errors and other errors that appear when you
   copy the code into cloudflare code editor and advise.
 * Best.

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/issues-with-worker-template-code/#post-17408929)
 * Hi,
   Instead of using workers you can now use cache rule to achieve the same: 
   [https://gist.github.com/isaumya/af10e4855ac83156cc210b7148135fa2](https://gist.github.com/isaumya/af10e4855ac83156cc210b7148135fa2)
 * Last time when I tested the worker I did not found any issues with it. If you
   would like to overwrite the worker code that is also possible, please check the
   FAQ tab inside the plugin settings. Under the advanced questions you will find
   the steps to do that.

Viewing 1 replies (of 1 total)

The topic ‘Issues with Worker Template Code’ is closed to new replies.

 * ![](https://ps.w.org/wp-cloudflare-page-cache/assets/icon-256x256.gif?rev=3234997)
 * [Super Page Cache – Cloudflare Cache, Page Speed & Core Web Vitals](https://wordpress.org/plugins/wp-cloudflare-page-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-cloudflare-page-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-cloudflare-page-cache/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [iSaumya](https://wordpress.org/support/users/isaumya/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/issues-with-worker-template-code/#post-17408929)
 * Status: resolved