The Un-Official Proxomitron Forum
Stop Automatic Redirects - Printable Version

+- The Un-Official Proxomitron Forum (https://www.prxbx.com/forums)
+-- Forum: Proxomitron Filters (/forumdisplay.php?fid=38)
+--- Forum: Privacy/Security/Spam (/forumdisplay.php?fid=10)
+--- Thread: Stop Automatic Redirects (/showthread.php?tid=1539)



Stop Automatic Redirects - Kye-U - Dec. 04, 2009 04:45 AM

Motivation for this filter comes from OpenDNS redirecting me to their sponsored search results page after typing in a non-existent domain. It works with all URL shortener services as well Smile! It's like this Firefox add-on: http://code.kliu.org/noredirect/

This filter will stop ISP DNS redirection hijacking and URL shorteners from automatically occurring without your consent.

Code:
[HTTP headers]
In = TRUE
Out = FALSE
Key = "!-|||||||||||| URL: Stop Automatic Redirects [ku] (In)"
URL = "$RESP(30[1237])"
Match = "$IHDR(Location: (http(s|)://\1/\2)\3)(^$TST(\1=www.\h))$CONFIRM(The page wants to redirect to the below URL:\n\n\3\n\nKill the connection?)"
Replace = "\k"

Read more on the different response codes that are matched in this filter (301, 302, 303, 307): http://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_Redirection

It tests if the redirection URL is simply prefixing the host with "www."), as there were false positives when loading Google.com and Youtube.com.