It is very strange that the webpage auto download a file if I use ngx.say() in my lua script.
ngx.say()
OpenResty build version: 20191.19.0515.1028
The default headers for openresty defines content-type as application/octet-stream. Both changing header with ngx.header['content-type'] = 'text/html' and setting default_type text/html; in the nginx.conf will fix it.
application/octet-stream
default_type text/html;