Wrong Vary: Accept-Encoding worker


I do not deflate/gzip at origin. So all the pages went to cloudflare is unzipped and do not have Vary: Accept-Encoding. Now I have 3 subdomains. 2 subdomains are using worker and 1 subdomain is not using worker.

Now about 1 domain which is not using worker. If i Request it with

curl -I -H “accept-encoding: gzip, deflate, br” subdomain_url
it has
Vary: Accept-Encoding

If I request it without

curl -I subdomain_url
It doesn’t have vary header.

This is the correct behavior.

Now the domain which are using worker. Even if I call those request using

curl -I subdomain_url
it has
Vary: Accept-Encoding

which is wrong behavior. How to solve this issue.

worker code included


 * Define regular expressions at top to have them precompiled.


const urlRegex = new RegExp('^(refreshce|gclid|cx|ie|cof|siteurl|zanpid|origin|utm_[a-z]+|fbid|fbclid|mr:[A-z]+|ref(id|src))$');

addEventListener('fetch', event => {





async function handleRequest(request) {


    let url = new URL(request.url)


    url = await normalizeUrl(url)


    let modifiedRequest = new Request(url, request)


    return fetch(modifiedRequest)


async function normalizeUrl(url) {

    let deleteKeys = []


    for(var key of url.searchParams.keys()) {





    deleteKeys.map(k => url.searchParams.delete(k))

    return url