Title: Cloudflare worker error (sg_worker)
Last modified: December 2, 2020

---

# Cloudflare worker error (sg_worker)

 *  Resolved [Anees](https://wordpress.org/support/users/vaneesv/)
 * (@vaneesv)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/cloudflare-worker-error-sg_worker/)
 * sg_worker worker will throw an error if accept is not present in the request 
   header
 *     ```
       if(
               (
                   !accept &&
                   !( accept.includes('text/html') || accept.includes('*/*') )
               ) ||
             requestURL.pathname.match(/^(?:\/wp-admin\/)/g)
           ) {
             bypassCache = true;
           }
       ```
   
 * `!accept &&` should be `accept &&`

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Stanimir Stoyanov](https://wordpress.org/support/users/sstoqnov/)
 * (@sstoqnov)
 * SiteGround Representative
 * [5 years, 6 months ago](https://wordpress.org/support/topic/cloudflare-worker-error-sg_worker/#post-13738786)
 * Hey [@vaneesv](https://wordpress.org/support/users/vaneesv/)
 * Correct, but the “Accept” header is required in all requests.
 * Regards,
    Stanimir
 *  Thread Starter [Anees](https://wordpress.org/support/users/vaneesv/)
 * (@vaneesv)
 * [5 years, 6 months ago](https://wordpress.org/support/topic/cloudflare-worker-error-sg_worker/#post-13766541)
 * [@sstoqnov](https://wordpress.org/support/users/sstoqnov/) Some clients are sending
   requests without accept.
 * Below code is logically incorrect.
 *     ```
       // Check if accept has value and the type is not text/html || */* || the user is accessing WP-ADMIN
           // Then only we set bypassCache as true else we will bypass that request and won't modify anything 
           if(
               (
                   !accept &&
                   !( accept.includes('text/html') || accept.includes('*/*') )
               ) ||
             requestURL.pathname.match(/^(?:\/wp-admin\/)/g)
           ) {
             bypassCache = true;
           }
       ```
   
 * Please change `!accept &&` to `accept &&` or `!accept ||` on cloudflare-worker.
   tpl line number 64

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cloudflare worker error (sg_worker)’ is closed to new replies.

 * ![](https://ps.w.org/sg-cachepress/assets/icon-256x256.gif?rev=2971889)
 * [Speed Optimizer - The All-In-One Performance-Boosting Plugin](https://wordpress.org/plugins/sg-cachepress/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-cachepress/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-cachepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-cachepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-cachepress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Anees](https://wordpress.org/support/users/vaneesv/)
 * Last activity: [5 years, 6 months ago](https://wordpress.org/support/topic/cloudflare-worker-error-sg_worker/#post-13766541)
 * Status: resolved