Back

html - ruby - sinatra - headers的重要性:ipfs的headers会阻碍普通浏览器的显示 ipfs headers browser firefox show content

发布时间: 2022-10-27 23:15:00

特别神奇

我的sinatra应用,充当了 ipfsgateway的代理。

如果返回 ipfs的headers的话,就会让浏览器卡住30秒左右,然后无法显示

(尝试了一下,就算删掉 access-control,  x-ipfs 开头的header也无法正常显示。估计是其他的header起作用)

HTTP/2 200 OK
access-control-allow-headers: Content-Type, Range, User-Agent, X-Requested-With
access-control-allow-methods: GET
access-control-allow-origin: *
access-control-expose-headers: Content-Length, Content-Range, X-Chunked-Output, X-Ipfs-Path, X-Ipfs-Roots, X-Stream-Output
cache-control: public, max-age=29030400, immutable
cf-cache-status: MISS
cf-ray: 760f184cc85b096c-HKG
content-type: text/html
date: Thu, 27 Oct 2022 23:08:40 GMT
etag: W/"QmfFjVBz5wd66kyd89RWkJJiWEMq1Fde3XGN9MBfx47Btp"
server: Caddy
server: cloudflare
vary: Accept-Encoding
x-cf-ipfs-cache-status: miss
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-ipfs-path: /ipfs/QmfFjVBz5wd66kyd89RWkJJiWEMq1Fde3XGN9MBfx47Btp/
x-ipfs-root: QmfFjVBz5wd66kyd89RWkJJiWEMq1Fde3XGN9MBfx47Btp
x-ipfs-roots: QmfFjVBz5wd66kyd89RWkJJiWEMq1Fde3XGN9MBfx47Btp
x-xss-protection: 1; mode=block
X-Firefox-Spdy: h2

如果不使用的话,就没问题。

HTTP/2 200 OK
content-type: text/html;charset=utf-8
server: Caddy
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
content-length: 27
date: Thu, 27 Oct 2022 23:11:35 GMT
X-Firefox-Spdy: h2

Back