configure accept header
Categories
(Core :: Networking, defect)
Tracking
()
People
(Reporter: srpen6+4cq2, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:101.0) Gecko/20100101 Firefox/101.0
Steps to reproduce:
- visit https://reddit.com/r/MapPorn/comments/1462x3v
- click the "play" button to expand the gallery.
- click the first image to expand
- click the image again to open in new tab
Actual results:
from here, Reddit is abusing the Accept header in order to force an HTML response. For example, if you make this request as Firefox does:
GET /ttj535aoj75b1.png?width=6460&format=png&auto=webp&v=enabled&s=03c44c0d62ce8189920d19e4092a176e03e47493 HTTP/1.1
Host: preview.redd.it
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
you get an HTML response:
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
but if you make the same request with a different header:
GET /ttj535aoj75b1.png?width=6460&format=png&auto=webp&v=enabled&s=03c44c0d62ce8189920d19e4092a176e03e47493 HTTP/1.1
Host: preview.redd.it
Accept: image/avif,image/webp,*/*
you get expected result:
HTTP/1.1 200 OK
Content-Type: image/webp
as far as I know Firefox has no way to configure this, so users are as the mercy of Reddit to be served whatever Reddit wants.
| Reporter | ||
Comment 1•2 years ago
|
||
note I am using "old" Reddit. if you are using new reddit:
- right click first image
- Open Image in New Tab
Comment 2•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Firefox Build System::General' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•2 years ago
|
||
(In reply to srpen6+4cq2 from comment #0)
as far as I know Firefox has no way to configure this,
Didn't network.http.accept work?
Updated•2 years ago
|
Comment 4•2 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #3)
(In reply to srpen6+4cq2 from comment #0)
as far as I know Firefox has no way to configure this,
Didn't
network.http.acceptwork?
I think setting this pref should accomplish what you want.
Alternatively, a webextension can also intercept and rewrite headers with more of targeted approach.
| Reporter | ||
Comment 5•2 years ago
|
||
looks like setting:
network.http.accept
to:
*/*
does fix it. strangely this page recommends network.http.accept.default:
https://developer.mozilla.org/docs/Web/HTTP/Content_negotiation/List_of_default_Accept_values
Comment 6•2 years ago
|
||
The document has been outdated so long. network.http.accept.default was removed between Firefox 60 and 68. network.http.accept was added since Firefox 85[1].
Description
•