The header is Content-Type: text/html;charset=XXX
After it is replaced, it becomes
Content-Type: text/html; charset=XXX
If I force charset
header_filter_by_lua 'ngx.header.content_type = "text/html; charset=UTF-8"';
it becomes
Content-Type: text/html; charset=UTF-8; charset=XXX
Thanks!
On Thursday, April 7, 2016 at 9:32:27 PM UTC-4, rpaprocki wrote:
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>
On Thu, Apr 7, 2016 at 4:49 PM, edo888
<edo...@gmail.com> wrote:
Hi,
I'm trying to override Content-Type response header by using:
header_filter_by_lua 'ngx.header.content_type = "text/html"';
However the charset is not being replaced and stays in the response.
How can I set/remove charset in Content-Type header?
Thanks!
.