postgresql - How to use Postgres and static file manupulation in Nginx -
i use nginx cdn file hosting system. saw great module nginx allows postgres connection (https://github.com/frickle/ngx_postgres) works well, when try use while having alias directive seems ignore alias or file download , rather give me empty file. idea is, use uuid url , find correct file doing query , using found details change filename header user's client download automatically set name original filename instead of uuid.
here code.
    location /dl{         postgres_output none;         postgres_pass   database;         postgres_query  "select * \"files\" uuid = '$args'";         postgres_set $filename 0 name;            alias /home/ubuntu/filestorage;         add_header content-disposition "attachment; filename=$filename";      }   i think somehow postgres directive locking block. there way can run postgres query without effecting download block?
it seem expect line
add_header content-disposition "attachment; filename=$filename";   will cause browser download file given $filename. not how content-disposition header works, tells browser interpret response body file. you're going have additional proper content client. perhaps want issue redirect?
Comments
Post a Comment