Skip to content

Loading…

Dynamic filter to block only external requests #713

Closed
anewuser opened this Issue · 8 comments

3 participants

@anewuser

I've written these dynamic filters to block Google Translate on external sites:

* translate.google.com * block
translate.google.com translate.google.com * noop

Could this be simplied to a single rule? I've tried using this to no avail:

* translate.google.com 3p-script block

Running uBlock 0.8.0.6 on Firefox 36.

@gorhill

What is the issue exactly? That you have to use two rules instead of one?

Tell me what you want to accomplish, not what you did.

@anewuser

If I hadn't told you that I had already found a way, you or somebody else would've assumed that I hadn't tried it by myself and then just pointed me to the wiki page.

With my rules, translate.google.com still works as expected, but external requests to its widget are blocked. I just wanted to make sure that my solution is the most efficient way to do it, or if there was a method to achieve it with a single rule.

@chrisaljoudi
Owner

@anewuser well, it's just that it's a bit unclear what the goal is, which is what @gorhill was asking for.

We can help, but it'd be appreciated if you can help us understand what you'd like to achieve. :)

@chrisaljoudi
Owner

@anewuser if I understand correctly, you should try this:

* translate.google.com 3p block

3p is for all third-party requests.

@gorhill

@chrisaljoudi That would not work. uBlock works differently than uMatrix.

A rule must not have both a specific destination hostname and a specific type, at least one of the destination hostname or the type must be *. Supporting anything more than this would require a larger matrix than the current UI -- i.e. uMatrix. Of course I don't intend to go further than what we have now in uBlock.

  • * translate.google.com * block = good, because type is *
  • translate.google.com translate.google.com * noop = good, because type is *
  • translate.google.com * 3p block = good, because destination type is *
  • * translate.google.com 3p-script block = bad, because neither destination or type is *
  • * translate.google.com 3p block = bad, because neither destination or type is *
  • * * * block = good, because at least one of destination or type is *

Bottom-line, if the UI allows it, it's allowed, otherwise the assumption should be it's not supported.

@gorhill

I guess this answer @anewuser's original question. It was late yesterday when I tried to understand the question, guess I needed some sleep.

@gorhill gorhill closed this
@chrisaljoudi
Owner

@gorhill ah, got it.

Well, I think @anewuser should be able to just add a traditional filter to get the effect he's seeking:

||translate.google.com$third-party
@anewuser

@gorhill @chrisaljoudi

Thank you for the help. Sorry for not being clear at first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.