• Resolved amirhmoradi

    (@amirhmoradi)


    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_PARAMETERS
    THIRD_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

    (@isaumya)

    Hi,
    Instead of using workers you can now use cache rule to achieve the same: 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.