This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: Youtube Safe Search (force Cookie)
Author
Message |
Jul3s
Newbie


Joined: 04 August 2010
Location: United Kingdom
Posts: 10
Posted: 25 October 2010 at 9:27am

Hi Everyone,
I am trying to force Youtube Safe Search using ISA Rewrite2 (presently
working for Google and Bing)
After having a look around the internet i have found out this needs to be
done by forcing some information into a cookie.

"cookie:(.*)PREF=[^&]*?\;"->"Cookie:$1"
"cookie:(.*)$"->"Cookie:$1; PREF=f2=8000000;"

Then, forcing the Safe Search.

"(^http://[^/]*\.youtube\.[^?]*\?)(.+&)?(safety_mode=[^&]*)"->"\1\2"
"(^http://[^/]+\.youtube\.[^?]*\?)"->"\1safety_mode=true&"

"(^http://[^/]*\.youtube\.[^?]*\?)(.+&)?(persist_safety_mode=[^&]*)"-
>"\1\2"
"(^http://[^/]+\.youtube\.[^?]*\?)"->"\1persist_safety_mode=1& "

Can this be done using ISA Rewrite2?

If so, can anyone help me with the code required to complete this.

Thanks in advance for any help.

Julian
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 October 2010 at 4:51am

Hello Julian,

I may suggest you to take a look at ISAPI_Rewrite 3 too.
The preliminary rule would look as following:

Code:
#in ISAPI_Rewrite 2
RewriteHeader Cookie: (.*) NAME=OOOOOOOOOOOOO
RewriteProxy (.*) http://Youtube

Directive RewriteHeader is described in documentation

Code:
#In ISAPI_Rewrite 3
RewriteProxy (.*) http://Youtube [CO:NAME:OOOOOOOOOOOOO]

Flag [CO:NAME:XX] is described in RewriteRule description


Regards
Andrew
Back to Top
 
Jul3s
Newbie


Joined: 04 August 2010
Location: United Kingdom
Posts: 10
Posted: 26 October 2010 at 9:03am

Hi Andrew,
Thanks for the reply.

I am able to force the safety mode on Youtube with the code below but it
has stopped other sites working. e.g. Facebook.com, when you try to
logon it returns you to the login screen to try again. Any ideas how i can
force it just to take effect for Youtube content?

I am unable to use ISAPI_Rewrite 3 because it is running on a TMG server.

Code:
RewriteHeader Cookie: (.*) PREF=f2=8000000
RewriteProxy (.*) http://Youtube.co

RewriteRule (^http://[^/]*\.youtube\.[^?]*\?)(.+&)?(safety_mode=[^&]*)"-
>"\1\2"
RewriteRule (^http://[^/]+\.youtube\.[^?]*\?)"->"\1safety_mode=true&"#
RewriteRule (^http://[^/]*\.youtube\.[^?]*\?)(.+&)?(persist_safety_mode=
[^&]*)"->"\1\2"
RewriteRule (^http://[^/]+\.youtube\.[^?]*\?)"-
>"\1persist_safety_mode=1& " [I,L]

Thanks
Julian
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 October 2010 at 9:38am

I assume you mean that your other rules that work with Facebook, etc stopped working.
Please, provide whole config file to figure out workaround.

Regards
Andrew
Back to Top
 
Jul3s
Newbie


Joined: 04 August 2010
Location: United Kingdom
Posts: 10
Posted: 27 October 2010 at 4:32am

Hi Andrew,
Thanks.


The Code:
[ISAPI_Rewrite]

RewriteHeader X-Rewrite-Url: .* $1

# Force Strict Search for Google

RewriteRule (.*)?google\.co(.*intl/en/(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*intl/en_uk/(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*calendar(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*aclk(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*nav(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*logo(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*isr(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*/options/(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*.js(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*.css(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*/images/firefox/(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*url=http(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?google\.co(.*q=http(.*).*) $1google.co$2 [I,L]
RewriteRule (.*)?www.google\.co(.*/[^?]*)(\?.*)? $1www.google.co$2(?
3$3&:\webhp?)safe=strict [I,L]
RewriteRule (.*)?images.google\.co(.*/[^?]*)(\?.*)?
$1images.google.co$2(?3$3&:\webhp?)safe=strict [I,L]
RewriteRule (.*)?video.google\.co(.*/[^?]*)(\?.*)? $1video.google.co$2(?
3$3&:\webhp?)safe=strict [I,L]

# Force Strict Search for Bing

RewriteRule (.*)?bing\.co(.*)?(/images[^?]*)(\?.*)?
$1bing.co$2$3$4&adlt=strict [I,L]
RewriteRule (.*)?bing\.co(.*)?(/search[^?]*)(\?.*)?
$1bing.co$2$3$4&adlt=strict [I,L]

# Youtube Safe Search

RewriteHeader Cookie: (.*) PREF=f2=8000000
RewriteProxy (.*) http://Youtube.co

RewriteRule (^http://[^/]*\.youtube\.[^?]*\?)(.+&)?(safety_mode=[^&]*)"-
>"\1\2"
RewriteRule (^http://[^/]+\.youtube\.[^?]*\?)"->"\1safety_mode=true&"#
RewriteRule (^http://[^/]*\.youtube\.[^?]*\?)(.+&)?(persist_safety_mode=
[^&]*)"->"\1\2"
RewriteRule (^http://[^/]+\.youtube\.[^?]*\?)"-
>"\1persist_safety_mode=1& " [I,L]

Facebook works fine if i remark 'RewriteHeader Cookie: (.*)
PREF=f2=8000000' but when its active i am unable to log in, just keeps
going back to the login page. (I am worried that there are more sites that
will be affected!)

Thanks again,
Julian
Back to Top
 
Sergey
Admin Group


Joined: 11 March 2005
Posts: 750
Posted: 27 October 2010 at 5:16am

Please try to replace all rules after # Youtube Safe Search with following:


# Youtube Safe Search

RewriteCond URL .*youtube\.com.*
RewriteHeader Cookie: (.*) PREF=f2=8000000

RewriteRule (.*)?youtube\.com(.*\?.*) $1youtube.com$2&safety_mode=true [I,L]
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum