Simple custom user filter not woking... :-(

Discussion in 'Discussion (AdGuard for Android)' started by Zack, Apr 19, 2017.

  1. Zack

    Zack New Member

    Joined:
    Apr 19, 2017
    Messages:
    6
    Hi,

    I'm trying to make a custom filter to redirect url or change part of the response but I can't make it to work!

    Source: https://104.131.201.115/services/json/?method=test

    I tried replacing the word "fail" with the word "error" in the response using the following filter:
    Filter: ||104.131.201.115^$replace=/fail/error/img
    But it did'nt work...

    So I tried redirecting the url with the filter:
    Filter: 104.131.201.115#%#AG_onLoad(function() { setTimeout(function() {window.location = "https://104.131.201.116";}, 300); });

    But it did'nt work either... :-(

    I red many posts about this but it feels like I don't get how to make filters at all... lol

    Can anyone help me?
     
  2. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    But why IP address, as I understand this rule belongs to pandora.com, right?
     
  3. Zack

    Zack New Member

    Joined:
    Apr 19, 2017
    Messages:
    6
    Yes, I red on the internet it could help with the country blocked problem.
     
  4. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    The thing is that AG won't filter HTTPS for the request when you use an IP address as it considers certificate invalid (certificate name does not match the domain name).
     
  5. Zack

    Zack New Member

    Joined:
    Apr 19, 2017
    Messages:
    6
    Would it work if I use pandora.com instead? What would the filter look like?
     
  6. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    Redirect won't work as this is not an HTML page and javascript won't help with it. There's not much we can do unless $redirect modifier is implemented.

    What for $replace, here it is:
    Code:
    ||pandora.com/services/json?method=test$replace=/fail/error/
     
  7. Zack

    Zack New Member

    Joined:
    Apr 19, 2017
    Messages:
    6
  8. Blaz

    Blaz Moderator & Translator Moderator

    Joined:
    Dec 21, 2014
    Messages:
    9,557
    There is a typo in above rule (missing / before ?):
    Code:
    ||pandora.com/services/json/?method=test$replace=/fail/error/
    
     
  9. Zack

    Zack New Member

    Joined:
    Apr 19, 2017
    Messages:
    6
    Not working either... I did some tests with some URLs and I believe I should be using this filter:

    ||tuner.pandora.com/services/json/?method=test.checkLicencing$replace=/fail/error/

    But sadly it's not working. Maybe I didn't set the application properly...
     
  10. Blaz

    Blaz Moderator & Translator Moderator

    Joined:
    Dec 21, 2014
    Messages:
    9,557
    Shows "error" fine for both json files you initially posted. Probably a cache issue.
     
  11. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    @Zack do you have HTTPS filtering enabled in AG settings? What browser do you use for testing it?
     
  12. Zack

    Zack New Member

    Joined:
    Apr 19, 2017
    Messages:
    6
    Thank you for your patience and quick answers :)

    I tried on a different browser (chrome) on my android phone and was still not working... The first browser I tried was the default internet app in Android Nougat.

    I did not have the HTTPS filtering enabled; I just turned it on (installing the certificate) then I restarted the phone and guess what... It works! :)

    Thank guys! :)
     
  13. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,140
    Yeah, it's mandatory for applying cosmetic rules on a https website:)