question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding "br" on Accept-Encoding modifies the minified polyfill

See original GitHub issue

Sorry for the lack of details on this issue, I didn’t have time to narrow down the cause, but I think the example are clarifying.

Request with Accept-Encoding: gzip, br

curl --location --request GET 'https://cdn.polyfill.io/v3/polyfill.min.js?features=Object.values,Object.entries,Object.assign,Array.from,Array.prototype.findIndex,Array.prototype.fill,Array.prototype.find,Array.prototype.includes,String.prototype.startsWith,String.prototype.endsWith,String.prototype.includes,Symbol,fetch,Promise,Map,WeakMap,Number.isInteger,Number.isNaN,Set,Function.name,URL,IntersectionObserver,Intl.~locale.en-GB&flags=gated' \
--header 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1' \
--header 'Accept-Encoding: gzip, br'

Results: the Intl polyfill is not included.

image

Request with Accept-Encoding: gzip

curl --location --request GET 'https://cdn.polyfill.io/v3/polyfill.min.js?features=Object.values,Object.entries,Object.assign,Array.from,Array.prototype.findIndex,Array.prototype.fill,Array.prototype.find,Array.prototype.includes,String.prototype.startsWith,String.prototype.endsWith,String.prototype.includes,Symbol,fetch,Promise,Map,WeakMap,Number.isInteger,Number.isNaN,Set,Function.name,URL,IntersectionObserver,Intl.~locale.en-GB&flags=gated' \
--header 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1' \
--header 'Accept-Encoding: gzip'

Results: the Intl polyfill is included: image

Other points

  • If I ask only for Intl on the parameters, both cases come with the requested Polyfill, so that’s why I couldn’t narrow down what also impacts this.
  • If I ask for the asset not minified, on both cases the Intl comes, so I was wondering there might be something related with caching.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
JakeChampioncommented, Nov 4, 2020

@lucis thanks for the issue. This was a caching issue and has been fixed now, I’ve tried all the curl requests in this issue’s comments and they are all returning the expected polyfills now 👍

curl --location --request GET 'https://cdn.polyfill.io/v3/polyfill.min.js?features=Object.values,Object.entries,Object.assign,Array.from,Array.prototype.findIndex,Array.prototype.fill,Array.prototype.find,Array.prototype.includes,String.prototype.startsWith,String.prototype.endsWith,String.prototype.includes,Symbol,fetch,Promise,Map,WeakMap,Number.isInteger,Number.isNaN,Set,Function.name,URL,IntersectionObserver,Intl.~locale.en-GB&flags=gated' \
--header 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 12_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Mobile/15E148 Safari/604.1' \
--header 'Accept-Encoding: gzip, br' | brotli --decompress

that returns Intl ☝️

curl --location --request GET 'https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver' \ --header 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Mobile/15E148 Safari/604.1' --header 'Accept-Encoding: gzip, br' | brotli --decompress

that returns ResizeObserver

The ie11 reqeuests return the same polyfills regardless of the compression used:

[[ `curl --location --request GET 'https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver' \ --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko' --header 'Accept-Encoding: gzip' --compressed` == `curl --location --request GET 'https://polyfill.io/v3/polyfill.min.js?features=ResizeObserver' \ --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko'` ]] && echo "Equal" || echo "Not equal"

Equal
0reactions
JakeChampioncommented, Nov 4, 2020

Let’s close this since nothing else is needed to be done 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug: 3.38+ does not detect iOS Safari features properly #2421
Bug report What Until including 3.37 the fetch polyfill is not delivered, ... Adding "br" on Accept-Encoding modifies the minified polyfill #2428.
Read more >
Minify and compress network payloads with brotli - web.dev
In this codelab, learn how Brotli compression can further reduce compression ratios and your app's overall size.
Read more >
Response compression in ASP.NET Core | Microsoft Learn
The response compression middleware allows adding additional compression ... Change Accept-Encoding: from gzip, deflate, br to none .
Read more >
Accept-Encoding - HTTP - MDN Web Docs
The Accept-Encoding request HTTP header indicates the content encoding (usually a compression algorithm) that the client can understand.
Read more >
compression npm
If you're following along at home, and aren't seeing Accept-Encoding: "br", make sure you're connecting over HTTPS. It is written in JavaScript, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found