Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sniff HTTP response headers in Chrome? for "attachment" content?

Tags:

Usually I'm able to sniff my HTTP requests using Chrome Dev Tools - network tab.

But it's not happening for download-files (i.e. when Content-Dsiplosition is set to Attachment;filename=xxx) - then Chrome just downloads the file and nothing is shown on the network tab.

How do I see those? I mean, in Chrome, without any 3rd party tools like PostMan.

PS. I need to see the headers my server sends, there's some debugging info I need.

like image 997
jazzcat Avatar asked Oct 05 '16 15:10

jazzcat


People also ask

How do I view HTTP response headers in Chrome?

To view the request or response HTTP headers in Google Chrome, take the following steps : In Chrome, visit a URL, right click , select Inspect to open the developer tools. Select Network tab. Reload the page, select any HTTP request on the left panel, and the HTTP headers will be displayed on the right panel.


1 Answers

When I try to paste an URL pointing to a downloadable file, directly into the browser address, it doesn't show anything on the network tab.

However, I've found a workaround that suits my use case. Create an .html file anywhere, and just create a link to that attachment (an alternative is to just open about:blank in the browser and edit the HTML in place).

<a href="https://example.com/example.ambiguous.file">download</a>

Then open that .html file and click on the link.

This causes the network tab to display the file you're trying to download, and so the headers.

In my case I was able to troubleshoot how the Content-Disposition headers was never sent to specific browsers.


EDIT (2017-11):

If this doesn't work with recent versions of Chrome, try putting it in an image tag. The objective is to sniff the HTTP response headers, not the content.

<img src="https://example.com/example.ambiguous.file">download</img>

like image 96
Hay Avatar answered Oct 14 '22 19:10

Hay