emptygif
語言: 繁體中文

所有語言和框架

Caddy Caddyfile

適用於 Caddy 的 Caddyfile 程式碼片段,以空 GIF 回應對 /pixel.gif 的請求,GIF 在啟動時只解碼一次。

Caddy Caddyfile

檔案
Caddyfile
執行
caddy run
# respond can't emit binary, so serve a file. Write it once:
#   printf '%b' '\x47\x49\x46\x38\x39\x61\x01\x00\x01\x00\x80\x00\x00\xff\xff\xff\x00\x00\x00\x21\xf9\x04\x01\x00\x00\x00\x00\x2c\x00\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02\x44\x01\x00\x3b' > /srv/pixel.gif
:8080 {
    handle /pixel.gif {
        root * /srv
        rewrite * /pixel.gif
        header Cache-Control "no-store"
        file_server
    }
}

我們執行了這段程式碼,並比對了它回傳的位元組。

驗證

curl -sI http://localhost:8080/pixel.gif

官方網站: Caddy