根据url/nginx设置内容配置

low*_*k3y 3 regex lua nginx content-disposition

让nginx像url一样提供静态文件,http://foobar.tld/<random_dir>/<file_md5sum_as_filename>我希望如果我在url的末尾指定?f="filename.filetype"- nginx解析那末端的查询字符串(如果已指定)并准备新的内容dispose匹配指定的参数并且没有任何动态后端,这是不可能的.

或实例 http://foobar.tld/<random_dir>/<file_md5sum_as_filename>?f="foobar.pdf"

这样的事情可以用nginx/lua模块完成吗?有没有人有任何有用的例子或做过类似的事情?

Ale*_*rov 9

纯Nginx配置

location / {
  if ($arg_f) {
    add_header Content-Disposition "attachment; filename=$arg_f";
  }
}
Run Code Online (Sandbox Code Playgroud)