emptygif
言語: 日本語

すべての言語・フレームワーク

nginx (empty_gif) nginx

/pixel.gif へのリクエストに空の GIF を返す、nginx (empty_gif) 用の nginx スニペット。GIF は起動時に一度だけデコードします。

nginx (empty_gif) nginx

ファイル
pixel.conf
実行
nginx -s reload
# ngx_http_empty_gif_module ships with standard nginx builds. empty_gif always
# serves nginx's own built-in 43-byte transparent 1x1 GIF; its bytes can't be
# changed (to serve your own GIF, use the static-file or njs variants).
server {
    listen 8080;

    location = /pixel.gif {
        empty_gif;
        add_header Cache-Control "no-store";
    }
}

このスニペットは実行し、返されたバイト列を照合しました。

確認

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

公式サイト: nginx (empty_gif)

nginx の他の例