Skip to content

Implement HTTP header filtering

Background / User story

eyeo/adblockplus/adblockpluscore#77 implements the filter option $header to allow URL blocking filters to match on http response headers.

See also eyeo/adblockplus/adblockpluschrome#312 (closed).

What to change

  • Design: N/A
  • Research: N/A
  • Spec: N/A
  • Legal: N/A
  • Development: Implement the blocking in a onHeadersReceived listener lib/requestBlocking.js. Filters should be queried with defaultMatcher.search() and request blocking should check for WhitelistFilter first and then blocking filter. See details in eyeo/adblockplus/adblockpluscore#77 on the expected blocking filters.

Hints for testers

There is a write up in confluence https://confluence.eyeo.com/display/ABC/HTTP+header+filtering (not externally viewable). This will be edited and added to the public documentation in the future.

Testing this feature:

  • testing the header blocking: ||example.com/images/*$header=content-type=text/javascript will block any JavaScript served from the images directories on example.com, based on the content-type.
  • testing allowlisting for header blocking on a domain. @@||example.com/images/*$header will disable header based blocking for this URL.
  • testing allowlisting for the whole domain: @@||example.com/images/* should also disable ANY header based blocking for the URL.

Hints for translators

N/A

Further information

It is possible that this be rendered impractical in manifest v3, however having this for other browsers is worth it.

Since we are likely to call the matcher for most requests, performance is important.

Edited by Hubert Figuière
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information