HeaderEditor icon indicating copy to clipboard operation
HeaderEditor copied to clipboard

Issues with redirect

Open vertigo220 opened this issue 5 years ago • 16 comments

I'm trying to set up a redirect for click . icptrack . com, but for some reason it only works if I leave off the http:// part. I've tried "https?://" (which is what I use, and works, in my other rules), "http://", "https://", "http[s?]", and other variants, but nothing works. Putting anything at the beginning, even "(.)", causes the redirect to not work. I even tried "(.)icptrack.com" thinking it would use the wildcard in place of "click" but it still didn't work. I can't figure out why this one link isn't working despite setting it up the same as other redirect rules.

Also, when it does work (when not including the "http://"), it changes the colon and slashes into HTML codes (i.e. http:// becomes http%3a%2f%2), so it still doesn't actually work.

vertigo220 avatar Nov 26 '18 22:11 vertigo220

Please provide rule content and test address

sylingd avatar Nov 29 '18 10:11 sylingd

http://click.icptrack.com/icp/relay.php?r=30080964&msgid=118033&act=UQ2S&c=1668667&destination=https%3A%2F%2Fwww.google.com%2F

In the email, when I hover over the link, it shows as https://www.google.com/ (I changed the actual link to google, but the behavior is identical), but when I click it or copy/paste it, it turns into the above link with the colon replaced by "%3A" and the /'s replaced by "%2F." So that appears to be its own issue, not directly related to HE; however, Redirect is able to still handle it, presumably interpreting the html code and changing it appropriately, so it seems HE should be able to as well. Also, there's the issue of not being able to include the "http://" at the beginning of the rule. I also tried going to "http://click.icptrack.com/icp/&destination=https://www.google.com/" as a test, which for some reason tries to redirect to "http//www.google.com/" (without the colon). Here's the rule:

Redirect Regex Match rule: click.icptrack.com/icp/(.)&destination=(.) -- this is where I can't include the http/https or even do something like "(.*)icptrack..." Normal Redirect to: $2

vertigo220 avatar Nov 29 '18 20:11 vertigo220

click.icptrack.com is blocked here.

Atavic avatar Nov 29 '18 20:11 Atavic

I'm not sure if you're suggesting that has something to do with the problem, which AFAIK it shouldn't, or just pointing it out, in which case I'm aware it's bad, which is why I'm trying to set up a redirect for it, so it's not used. Unfortunately, while I can get it working with Redirector very easily, HE seems to have multiple issues with it.

vertigo220 avatar Nov 29 '18 20:11 vertigo220

It is listed as a tracking URL that appears in emails, others have blocked it and read the emails with no issues. Have you tried to simply block it?

Atavic avatar Nov 29 '18 21:11 Atavic

The issue isn't with reading the email, it's when clicking the link in the email. It is blocked by uBO, but that's irrelevant here. The problem is that I want to be able to click the link and have it take me straight to the actual link, skipping the icptrack intermediary step and its own redirect, instead doing the redirect myself without having to connect to icptrack. This is accomplished when the redirect works; unfortunately, it only sort of works with HE due to the above-mentioned issues.

vertigo220 avatar Nov 29 '18 22:11 vertigo220

You can try this rule, It worked fine in my test.

  • Match rule: https?://click.icptrack.com/icp/(.*?)&destination=(.*?)
  • Redirect to: $2

image

sylingd avatar Nov 30 '18 15:11 sylingd

In addition, UBO may also attempt to redirect to this address, which will cause the redirect not work

sylingd avatar Nov 30 '18 15:11 sylingd

Ok, that rule worked. I realized the one I gave as an example earlier I accidentally put (.) instead of (.), but I was using (.) in HE. The problem appears to be the 's for escaping the periods. So the question is, why are these normally required but here not only are they not required, they actually break it?

vertigo220 avatar Dec 01 '18 18:12 vertigo220

Please put the rules between ` and `, such as:

`Your rule`

This is the syntax of Markdown. If you don't do this, I won't be able to see your rules normally:

image

sylingd avatar Dec 04 '18 15:12 sylingd

Ah, so I didn't type the rule in wrong, I just didn't format it correctly to prevent it from being altered by GitHub. Sorry. Here's what I had originally:

click\.icptrack\.com/icp/(.*)&destination=(.*)

So as I mentioned before, the problem was apparently the \'s before the dots, which doesn't make sense because they're supposed to be there, and other rules have them and work fine.

vertigo220 avatar Dec 04 '18 16:12 vertigo220

Ok, this is driving me nuts. I'm not sure if HE doesn't follow regex rules or if I'm missing something or what, but every time I try to make a rule, even though I'm doing the same thing as several other rules and just changing the URL, it's a struggle and often I can't get it to work. And I still don't get why some of my rules require the \ to escape the dots and some only work when I don't do it. It just all seems very inconsistent.

Here's my current problem (trying to set up a redirect for Amazon tracking links):

Link: https://aax-us-east.amazon-adsystem.com/x/c/Qpp7cMr7wgDkNNDyP7FqXgUAAAFofzzVjgEAAAH2AS6IkYM/https://www.amazon.com/dp/B00DEF2G1Y?aaxitk=C.sLmOCplfyvXC.KtODaqA&pd_rd_i=B00DEF2G1Y&pf_rd_p=3ff6092e-8451-438b-8278-7e94064b4d42&hsa_cr_id=4038740680701&sb-ci-n=asinImage&sb-ci-v=https%3A%2F%2Fimages-na.ssl-images-amazon.com%2Fimages%2FI%2F51I4tZLE1hL.jpg&sb-ci-a=B00DEF2G1Y

Match rules tried:

https?://(.*?).amazon-adsystem.com/(.*?)dp/(.*?)?(.*?)
https?://(.*?).amazon-adsystem.com/(.*?)dp/(.*?)\?(.*?)
https?://(.*?).amazon-adsystem.com/(.*?)dp/(.*?)?

I set up the redirect to simply go to https://www.google.com/ to first test if the link was being caught by the rule, but one rule redirected me to

https://www.google.com/00DEF2G1Y?aaxitk=C.sLmOCplfyvXC.KtODaqA&pd_rd_i=B00DEF2G1Y&pf_rd_p=3ff6092e-8451-438b-8278-7e94064b4d42&hsa_cr_id=4038740680701&sb-ci-n=asinImage&sb-ci-v=https%3A%2F%2Fimages-na.ssl-images-amazon.com%2Fimages%2FI%2F51I4tZLE1hL.jpg&sb-ci-a=B00DEF2G1Y

and the other redirected me to

https://www.google.com/aaxitk=C.sLmOCplfyvXC.KtODaqA&pd_rd_i=B00DEF2G1Y&pf_rd_p=3ff6092e-8451-438b-8278-7e94064b4d42&hsa_cr_id=4038740680701&sb-ci-n=asinImage&sb-ci-v=https%3A%2F%2Fimages-na.ssl-images-amazon.com%2Fimages%2FI%2F51I4tZLE1hL.jpg&sb-ci-a=B00DEF2G1Y

when none of them should have anything from the clicked link in the redirect. ~~I don't remember which was which, though~~ (after changing it again it went back to redirecting to the above, and the first is from the first rule and the second is from the second rule), since trying it again to check resulted in me being redirected to google.com as it should be, so it seems there was a delay before it started working properly, though as much of a problem as that is in itself, it doesn't explain why it was redirecting to google.com/$3. I originally had it redirecting to https://www.amazon.com/dp/$3, so it's almost as if after changing it to google it was blending the two.

Also, the third one, without the (.*?) at the end, technically shouldn't even be caught by the rule, since the link doesn't end with a ?, and that rule states to match only a URL that does, since it doesn't have a (.*) or (.*?) at the end.

So am I just not getting it, or is there something not right here? It frustrates me that I can make rules so much easier and more consistently in Redirector, and I don't want to have to come here for help every time, but I prefer HE over Redirector for its capabilities and I'd rather not run both.

vertigo220 avatar Jan 24 '19 10:01 vertigo220

I have no regex knowledge, but I know that:

aax-us-east.amazon-adsystem.com/x/c with a Cloudfront ID:Qpp7cMr7wgDkNNDyP7FqXgUAAAFofzzVjgEAAAH2AS6IkYM has tracking purposes.

https://www.amazon.com/dp/B00DEF2G1Y?aaxitk=C.sLmOCplfyvXC.KtODaqA Is the real link to a Fluke Multitester

Plus some trackers: &pd_rd_i= &pf_rd_p= &hsa_cr_id= &sb-ci-n= &sb-ci-v=

Atavic avatar Jan 24 '19 17:01 Atavic

Yes. The real link is simply https://www.amazon.com/dp/B00DEF2G1Y

I know it's a tracking link, that's why I'm trying to set up a redirect for it. The problem is getting the redirect to actually work.

vertigo220 avatar Jan 24 '19 19:01 vertigo220

Try this rule:

Match rule: https?://(.*?).amazon-adsystem.com/(.*?)http(.*?)dp/(.*?)\?(.*) Redirect to: http$3$4

Or:

Match rule: https?://(.*?).amazon-adsystem.com/(\w+)/(\w+)/(\w+)/(.*?)\?(.*) Redirect to: $5

sylingd avatar Jan 27 '19 04:01 sylingd

Ok, I did the first one, but it failed because it was missing "dp/" and instead of adding that (i.e. http$3dp/$4) I just changed it to https?://(.*?).amazon-adsystem.com/(.*?)http(.*?)\?(.*) > http$3 though I didn't really see what's so different about that compared to what I tried:

https?://(.*?).amazon-adsystem.com/(.*?)dp/(.*?)\?(.*?) vs https?://(.*?).amazon-adsystem.com/(.*?)http(.*?)\?(.*)

Then I noticed I used a non-greedy operator at the end and you didn't. So I retried mine changing that one thing ( https?://(.*?).amazon-adsystem.com/(.*?)dp/(.*?)\?(.*) ) and it worked. Not sure if using it at the end should break it like that (i.e. if that's a wrongful use of regex) or if it's a bug in HE. But then, in the first rule of this thread you had me use a match rule ending with (.*?) and it worked, so I'm at a loss.

vertigo220 avatar Jan 30 '19 20:01 vertigo220