Override Content-Type header with proxied requests

andrea.mandolo nginx-forum at nginx.us
Thu May 23 15:07:28 UTC 2013

Hi !!

i have a Nginx server that operates as a reverse proxy to a my bucket in
Amazon S3.

Amazon S3 service could deliver contents with wrong Content-Type header,
so i would like to override this header by referring to file extension.

In other servers i have just configured the "types" block with all mime
types mapped with file estensions,
but this approach only works when Nginx delivers contents directly (as a
origin server).
If the server is a reverse proxy, doesn't add a new Content-Type header, but
honors Content-Type (if exists) received by the origin.

Is it possible to override the content-type response header using "types"
block? Is there any best practice to override content-type header by file
extensions? Is "map" suggested for this purpose or using multiple "location"
block is better?

Thanks in advance!!

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,239473,239473#msg-239473

More information about the nginx mailing list