Zstd empty

Hi guys, how are you? i have an issue with the ZStandard… if you can help me with this… look this is the problem that the programer told me…

There’s a relatively new compression standard, ZStandard (zstd), that’s supported by Chrome and Firefox. It isn’t supported by Safari yet.When Accept-Encoding contains zstd in the list, the response will be 0 bytes and empty.

You can replicate this in Postman by adding the header Accept-Encoding with value zstd . It doesn’t seem to matter if other encodings are available (i.e. setting it to gzip, deflate, br, zstd still breaks it)I double-checked it wasn’t something the JS API was mishandling by sending a request directly to the API (without the tunnel) and the API responded ok.

Something on Cloudflare’s end is broken when it comes to ZStandard compression.Unfortunately, Accept-Encoding isn’t a header you can override from the browser, and I tried to add a transform rule to the Cloudflare tunnel but they don’t allow changing the Accept-Encoding header there either.

what do you think about this?

thanks

Can you provide a URL where you’re seeing this?

Works fine for me

$ curl https://free.walshy.dev/cf.json -H 'Accept-Encoding: zstd' -v -o output.zst
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 188.114.97.5:443...
* Connected to free.walshy.dev (188.114.97.5) port 443 (#0)
* ALPN: offers h2,http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
{ [19 bytes data]
* TLSv1.3 (IN), TLS handshake, Certificate (11):
{ [2311 bytes data]
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
{ [80 bytes data]
* TLSv1.3 (IN), TLS handshake, Finished (20):
{ [52 bytes data]
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.3 (OUT), TLS handshake, Finished (20):
} [52 bytes data]
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=California; L=San Francisco; O=Cloudflare, Inc.; CN=free.walshy.dev
*  start date: Jan 11 00:00:00 2024 GMT
*  expire date: Dec 31 23:59:59 2024 GMT
*  subjectAltName: host "free.walshy.dev" matched cert's "free.walshy.dev"
*  issuer: C=US; O=Cloudflare, Inc.; CN=Cloudflare Inc ECC CA-3
*  SSL certificate verify ok.
} [5 bytes data]
* using HTTP/2
* h2 [:method: GET]
* h2 [:scheme: https]
* h2 [:authority: free.walshy.dev]
* h2 [:path: /cf.json]
* h2 [user-agent: curl/8.1.0-DEV]
* h2 [accept: */*]
* h2 [accept-encoding: zstd]
* Using Stream ID: 1 (easy handle 0x13b815c00)
} [5 bytes data]
> GET /cf.json HTTP/2
> Host: free.walshy.dev
> User-Agent: curl/8.1.0-DEV
> Accept: */*
> Accept-Encoding: zstd
>
{ [5 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [230 bytes data]
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
{ [230 bytes data]
* old SSL session ID is stale, removing
{ [5 bytes data]
< HTTP/2 200
< date: Tue, 22 Oct 2024 21:53:47 GMT
< content-type: application/json
< x-plan: free
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=oKUqAv1CEgKA9iLTIi2ZgHU%2BnqKJI7wh1c5anlDxSGkvqVkW5c2mvhMEPDjrQEjon3lJm21FNW2%2BudOdSdrKGU8tOapFTNfbtBxJrk41zYZi6nPOYhZqmuM6JhDJt2dBwDU%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< vary: Accept-Encoding
< server: cloudflare
< cf-ray: 8d6cb8e20bd1cbe3-MAD
< content-encoding: zstd
< alt-svc: h3=":443"; ma=86400
< server-timing: cfL4;desc="?proto=TCP&rtt=31082&sent=5&recv=7&lost=0&retrans=0&sent_bytes=3192&recv_bytes=760&delivery_rate=88585&cwnd=215&unsent_bytes=0&cid=01849b7ae8caf27f&ts=56&x=0"
<
{ [1038 bytes data]
100  1038    0  1038    0     0   7180      0 --:--:-- --:--:-- --:--:--  7309
* Connection #0 to host free.walshy.dev left intact

$ ls -lah output.zst
-rw-r--r--  1 walshy  staff   1.0K Oct 22 22:53 output.zst
$ file output.zst
output.zst: Zstandard compressed data (v0.8+), Dictionary ID: None

yes sure,
https://cichlid.js-software.com/auth/
When I want to log in with username and password I get an error, because a json should arrive that I can never see…
I tried to disable “Zstd Content-Encoding” in chrome at chrome://flags and work… but only on my local computer obviously…

for the other side, i was reading this post…

and maybe i need this Compression Rules… but i dont have the way to do it…

对于这里提到的修复,是对站点关闭了zstd功能,而不是修复了页面错误(也就是只返回br压缩) Cloudflare Status - Issues with Zstd compression

是的,zstd目前依旧有问题
image

cloudflare发送了zstd的错误数据,观察chrome响应头未包含 content-encoding: zstd 导致浏览器输出了错误的信息一大堆乱码,并且数据被截断,65KB的页面内容只获得了19KB

截至目前2024年10月29日,zstd的该问题依然存在还未修复

你可以通过这个方式来禁用zstd压缩

入口
https://dash.cloudflare.com/?to=/:account/:zone/rules/compression-rules

如果你能忍受zstd产生的页面错误,请等待cloudflare开发人员更新修复
image

This topic was automatically closed after 14 days. New replies are no longer allowed.