Nginx + LUA, how to output file? -


having trouble file output in nginx + lua. chosen lua, because nginx logic pretty complicated, based on referrer or subdomains, etc.

having request /img/am1/s/1.jpg need check if file exists in /somepath/am1/1.jpg. if exists, output it, otherwise proxy request backend.

ok, found it

content_by_lua '     local file = "/path..."     local f = io.open(file, "rb")     local content = f:read("*all")     f:close()     ngx.print(content) '; 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -