Your example seems fine:
root@soter:/usr/local/openresty/nginx# grep default_type conf/nginx.conf
default_type text/plain;
root@soter:/usr/local/openresty/nginx# cat conf/nginx.conf
[...snip...]
location /html-test {
content_by_lua 'ngx.say("<html><head><title>Hello</title></head><body>Hello, world!</body></html>")';
header_filter_by_lua 'ngx.header.content_type = "text/html"';
}
poprocks@soter:~$ curl localhost/html-test
<html><head><title>Hello</title></head><body>Hello, world!</body></html>
poprocks@soter:~$ curl -I localhost/html-test
HTTP/1.1 200 OK
Date: Fri, 08 Apr 2016 01:31:11 GMT
Content-Type: text/html
Connection: keep-alive
Can you post a full, reproducible example of your configuration>