add_header is effective only when the response code is equal to 200, 204, 301, 302 or 304. You should try headers_more module. Posted at Nginx Forum: http://forum.nginx.org/read.php?2,214931,214932#msg-214932