Today we were called to fix a strange issue that was happening to one of our colleagues when trying to download a PDF file from one of our Document Management Systems. The error was related to a single file and sounded like this:
This page isn't working
(the website) sent an invalid response.
That sounded quite strange, especially considering the fact that a lot of other files - same extension, same size and so on - was working fine.
We found the solution rather quickly by finding this StackOverflow thread, which luckily enough pointed us to the right direction. The issue was related to a single "comma" in the filename as defined in the Content-Definition header, which was programmatically defined in the back-end code:
Response['Content-Disposition'] = 'attachment; filename=file,name.pdf';
It's worth noting that, even if the mentioned SO topic was related to Django, it's definitely an universal issue: we were getting it with ASP.NET C# as well.
Anyway, the proper solution was to encompass the filename with double quotes, thus avoiding HTTP header mismatches:
Response['Content-Disposition'] = 'attachment; filename="file,name.pdf"';
That's pretty much about it. I hope that this quick fix will help those who'll be stuck with this issue as well!
6 Comments on “ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION error in Chrome - How to fix How to address a nasty HTTP error that you could get in Google Chrome browser when you're handling files with commas in their filename”
If you guys did not share it I would never figure out what was the problem with my code. That is the importance of sharing solutions. Thank you.
Just another comment from the internet saying that this post helped save a lot of stress!!
pff.. thank Ryan ;)
Thank you, Ryan, You are my hero.
Thanks to you! If you’ve found our blog useful, don’t forget to like us on FB and Twitter :)
Thanks Ryan! Saved me a lot of time…