emptygif
语言: 简体中文

所有语言和框架

HAProxy HAProxy config

一个用于 HAProxy 的 HAProxy config 代码片段,以空 GIF 响应对 /pixel.gif 的请求,GIF 在启动时只解码一次。

HAProxy HAProxy config

文件
haproxy.cfg
运行
haproxy -f haproxy.cfg
# Write the file once (it is read into memory at startup):
#   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' > /etc/haproxy/pixel.gif
defaults
    mode http
    timeout connect 5s
    timeout client 30s
    timeout server 30s

frontend www
    bind :8080
    http-request return status 200 content-type image/gif file /etc/haproxy/pixel.gif hdr Cache-Control no-store if { path /pixel.gif }
    # default_backend app

我们运行了此代码片段,并比对了它返回的字节。

验证

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

官方网站: HAProxy