26.09.2017, 06:38
Change content-type (use this list: https://developer.mozilla.org/en-US/docs...MIME_types) and filename as needed:
Code:
<?
data = ...
conttype = 'application/json'
filename = 'data.json'
ngx.header.content_type = conttype
ngx.header.content_disposition = 'attachment; filename="' .. filename .. '"'
write(data)