uBlock icon indicating copy to clipboard operation
uBlock copied to clipboard

redirect filters

Open mapx- opened this issue 9 years ago • 6 comments

chrome Version 62.0.3202.38 (Official Build) beta (64-bit) uBo 1.14.11.110 default setup, disabling ublock filters

tests on phonearena.com

these 4 filters don't work (the filter is showed in logger but without the redirect=nooptext keyword)

.info/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com
|htpps://*.info/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com
/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com
|https://mxq9cw.gff6166tdt2i4fc155zi11.info/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com

only this filter is working fine (the info server can vary ...) ||mxq9cw.gff6166tdt2i4fc155zi11.info/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com

Is this an expected behaviour ?

mapx- avatar Oct 04 '17 16:10 mapx-

Is this an expected behaviour ?

Yes, by design. The filter must be anchored to a hostname (using ||) without wildcard, or alternatively a single wildcard if the filter must apply to any destination. So this means these should work:

||info/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com

Or, though less ideal because broader:

*/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com

These restrictions are to ensure an efficient processing, this allows to store the redirection information efficiently internally. For example, the second form is used in:

*/fuckadblock-$script,redirect=fuckadblock.js-3.2.0

gorhill avatar Oct 04 '17 16:10 gorhill

I see. However at least this 1 should be equivalent to || case:

|https://mxq9cw.gff6166tdt2i4fc155zi11.info/http$xmlhttprequest,redirect=nooptext,domain=phonearena.com

mapx- avatar Oct 04 '17 17:10 mapx-

However at least this 1 should be equivalent to || case:

Yes, since uBO can extract a wildcard-less hostname from that filter, it should accept it.

gorhill avatar Oct 04 '17 17:10 gorhill

The second filter in that list of four is misspelled: htpps should be https.

lewisje avatar Oct 06 '17 10:10 lewisje

Anyway... xmlhttprequest redirect Not working on Firefox

lain566 avatar Oct 06 '17 10:10 lain566

After reconsideration, I rather stick to the current restrictions, they are not crippling and can take care of the filter issue here. Relaxing the restrictions will just lead to more false expectations regarding what is allowed. So in short, the filter must be of the form:

||[valid hostname label]^...$[type],redirect=[token],...
||[valid hostname label]/...$[type],redirect=[token],...
*/...$[type],redirect=[token],...

I added minimal documentation for this.

gorhill avatar Oct 06 '17 11:10 gorhill