{"id":5277,"date":"2012-04-11T17:56:17","date_gmt":"2012-04-11T12:26:17","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=5277"},"modified":"2016-12-19T15:06:27","modified_gmt":"2016-12-19T09:36:27","slug":"duplicate-headers-received-from-server-fix-for-chrome","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/duplicate-headers-received-from-server-fix-for-chrome\/","title":{"rendered":"Duplicate headers received from server issue on chrome"},"content":{"rendered":"<p>Hi,<br \/>\n&nbsp;<br \/>\nRecently, in my project while downloading <strong>some files(not on all files)<\/strong> i am getting exception on chrome, that say :<br \/>\n&nbsp;<br \/>\n<strong>Duplicate headers received from server<\/strong><br \/>\n<br \/>\n<em>Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response-splitting attacks.<\/em><br \/>\n&nbsp;<\/p>\n<p>But when i download the same files on IE, Firefox and other browsers that causing exception, no problem occur it work like charm. \ud83d\ude42<br \/>\n&nbsp;<br \/>\nBut its weird that why is chrome giving exception only on some files while downloading, then i searched, i found that new release of chrome has this problem. It seem like Content-disposition header become very strict and sensitive, in the spec that chrome uses.<br \/>\n&nbsp;<br \/>\nSolution that worked for me to solve the problem :<br \/>\n&nbsp;<br \/>\n<strong>Wrong :<\/strong><\/p>\n<p><em>response.setHeader(&#8220;Content-disposition&#8221;, &#8220;attachment; filename=${fileName}&#8221;)<\/em><\/p>\n<p><strong>Correct :<\/strong><\/p>\n<p><em>response.setHeader(&#8220;Content-disposition&#8221;, &#8220;attachment; filename=\\&#8221;&#8221;+fileName+&#8221;\\&#8221;&#8221;)<\/em><br \/>\n&nbsp;<br \/>\nIt worked for me. Hope it helps you also \ud83d\ude42<br \/>\n&nbsp;<br \/>\nThanks,<br \/>\nTarun Pareek<br \/>\ntarun@intelligrape.com<\/p>\n<p><a href=\"http:\/\/www.tothenew.com\/blog\/author\/tarun\/\">More Blogs by Me<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi, &nbsp; Recently, in my project while downloading some files(not on all files) i am getting exception on chrome, that say : &nbsp; Duplicate headers received from server Error 349 (net::ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION): Multiple Content-Disposition headers received. This is disallowed to protect against HTTP response-splitting attacks. &nbsp; But when i download the same files on IE, Firefox [&hellip;]<\/p>\n","protected":false},"author":20,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":84},"categories":[7],"tags":[795,796,794,792,791,4840,9,793],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/5277"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/20"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=5277"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/5277\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=5277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=5277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=5277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}