Having nginx serving static files with url like http://foobar.tld/<random_dir>/<file_md5sum_as_filename> and I would like if I specify at the end of url ?f="filename.filetype" – nginx parse that query string at the end (if is specified) and prepares new content dispose matching specified arguments and without any dynamic backend that’s like impossible.
or instance http://foobar.tld/<random_dir>/<file_md5sum_as_filename>?f="foobar.pdf"
Can something like this be done with nginx/lua module? Does any one have any useful example or has done anything similar?
This is indeed possible with nginx-lua; in particular, the header_filter_by_lua directive.
Something like the following ought to do the trick: