content-type header charset info problem

Maxim Dounin mdounin at mdounin.ru
Thu May 10 18:33:58 UTC 2012


Hello!

On Thu, May 10, 2012 at 11:51:01AM -0400, djeps wrote:

> Hello, 
> 
> I'm trying to add "charset=utf-8" to the Content-Type header. 
> 
> When I don't use "Accept-Encoding:gzip, deflate", all is fine. 
> 
> When I add the above request header, the response header excludes the
> charset info from the Content-Type header.
> 
> I thoroughly read the documentation and it's not clear if it's by design
> nor why I can't have both charset info into Content-Type and "Vary:
> Accept-Encoding, User-Agent" response headers.
> 
> $ curl -s -D- -o/dev/null -H"Host:www.stripped.com" http://localhost/
> HTTP/1.1 200 OK
> Date: Thu, 10 May 2012 15:48:36 GMT
> Content-Type: text/html; charset=utf-8
> Connection: close
> Server: mycacheserver 1.3.2
> Last-Modified: Thu, 10 May 2012 15:45:56 GMT
> Cache-Control: public, max-age=60
> ETag: 21adca4e3bc9e6517b61d7385c2536c7
> Expires: Thu, 10 May 2012 15:49:36 GMT
> Vary: Accept-Encoding, User-Agent
> Content-Length: 222581
> 
> $ curl -s -D- -o/dev/null -H "Accept-Encoding:gzip, deflate"
> -H"Host:www.stripped.com http://localhost/
> HTTP/1.1 200 OK
> Date: Thu, 10 May 2012 15:33:10 GMT
> Content-Type: text/html
> Connection: close
> Server: mycacheserver 1.3.2
> Last-Modified: Thu, 10 May 2012 15:32:53 GMT
> Cache-Control: public, max-age=60
> ETag: 7dcd476ac501f1929f2ad8efd1731f6
> Expires: Thu, 10 May 2012 15:34:10 GMT
> Vary: Accept-Encoding, User-Agent
> Content-Encoding: gzip
> Content-Length: 39914
> 
> Any thougths? 

This doesn't looks like nginx is responsible for gzipping here 
(note: Content-Length header present in gzipped response, which 
might happen only with gzip_static, but ETag presense excludes 
it).  So it's likely the problem is somewhere outside of nginx (if 
it's involved at all).

Maxim Dounin



More information about the nginx mailing list