OpenResty (Lua) Lua
OpenResty (Lua) ਲਈ Lua ਸਨਿੱਪਟ, ਜੋ /pixel.gif ਦੀਆਂ ਬੇਨਤੀਆਂ ਦਾ ਜਵਾਬ ਖਾਲੀ GIF ਨਾਲ ਦਿੰਦਾ ਹੈ; GIF ਸ਼ੁਰੂਆਤ ’ਤੇ ਇੱਕ ਵਾਰ ਡੀਕੋਡ ਹੁੰਦੀ ਹੈ।
OpenResty (Lua) Lua
http {
init_by_lua_block {
-- decoded once, when the master process loads the config
PIXEL_GIF = ngx.decode_base64("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")
}
server {
listen 8080;
location = /pixel.gif {
content_by_lua_block {
ngx.header["Content-Type"] = "image/gif"
ngx.header["Content-Length"] = #PIXEL_GIF
ngx.header["Cache-Control"] = "no-store"
ngx.print(PIXEL_GIF)
}
}
}
}
ਅਸੀਂ ਇਹ ਸਨਿੱਪਟ ਚਲਾਇਆ ਅਤੇ ਇਸ ਵੱਲੋਂ ਵਾਪਸ ਕੀਤੀਆਂ ਬਾਈਟਾਂ ਦੀ ਤੁਲਨਾ ਕੀਤੀ।
ਜਾਂਚੋ
curl -sI http://localhost:8080/pixel.gif