4 Replies Latest reply on Jun 19, 2013 3:42 PM by btlyric

    Coaching + PDStorage


      Say that I have a rule set that activates when URL.HostBelongsToDomains<FOO> is true.


      This rule set provides a coaching page that requests that the AUP for accessing the domains in FOO is accepted. When accepted, the connection is redirected to the original URL.


      As with many things of this nature, while we started with FOO, we now have FOO, FOO1, FOO2...FOO10.


      Each FOO# has its own rule set of at least 4 rules and subsequent rules also need to be in place for everything to work. It occurred to me tonight that I could utilize PDStorage to help eliminate most of the standard FOO# rulesets by doing this:


      Top level criteria: URL.HostBelongsToDomains<BAR> equals true


      1) Quota.Coaching.IsActivationRequest.Strict<BAR> equals true, Redirect (original URL), Events: PDSTorage.AddUserData.String (String.Concat ("BAR-",URL.Host),"BAR Accepted")<BAR>

      2) PDStorage.GetUserData.String (STring.Concat ("BAR-", URL.Host))<BAR> does not equal "BAR Accepted" AND (Quota.Coaching.SessionExceeded<BAR> equals true OR Quota.Coaching.SessionExceeded<BAR> equals false), Block, Return BAR notification page (which has the coaching activation link)

      3) Generic block upload rule

      4) PDStorage.GetUserData.STring (String.Concat ("BAR=", URL.Host)<BAR> equals "BAR Accepted", Stop Rule set


      This works great for destinations that have a single URL.Host, but breaks down for destinations that utilize multiple domains. In the original concept, we handle this by starting a Coaching session for all connections associated with that specific service and then using that data for future connections.


      It seems to me that there should be a way to write multiple values to PDStorage, or perhaps use a PDStorage list? In other words, if foo.com is accessed and other related domains are foo.net, foocloud.com and foocdn.net, is it possible to write all of those domains to PDStorage at the same time? If so, what would the logic for querying against PDSTorage.GetUserData.String be to pull back all of those possible values?


      Having multiple lists is okay. The goal is to simplify the actual implementation of access to specific destination domains that have been deemed as being okay.

        • 1. Re: Coaching + PDStorage

          Pushing the envelope again, I see.


          The only thing that comes to mind is by somehow checking the referer header too.


          If you coach on a specific site like facebook.com and activate a session, the content site of fbcdn.com does not get activated because it's embedded content inside the original index page.


          You really need to check if the URL.Host is in the list and check if the referer host is in the list too.


          All the fbcdn.com content should have a referer of facebook.com.

          It's the same with yahoo.com and ytimg.com,

          or cnn.com and cdn.turner.com,

          or almost any site, for that matter.


          So if you you activate cnn.com, you should also find a way that cdn.turner.com is allowed to. The only way i can think is to check if the referer is cnn.com.


          Request GET http://i.cdn.turner.com/cnn/.e/img/3.0/1px.gif HTTP/1.1

          Referer http://www.cnn.com/

          Host i.cdn.turner.com



          It seems we've had this discussion before.

          1 of 1 people found this helpful
          • 2. Re: Coaching + PDStorage

            We had a very similar previous discussion.


            Ignore the coaching part -- I'm only using it to bring up the notification page where you can click to say that yeah, you understand xyz/pdq. The real key is the PDStorage portion -- I'm using it to write an entry to the effect of XYZ-hostname, ACCEPTED AUP.


            Using facebook as an example, let's say that I decide to permit access to facebook via the combination of coaching and PD Storage.


            Coaching brings up the activation page and once activation is live, I want to write an entry to PD Storage to the effect of PDStorage.AddUserData.String (String.Concat ("XYZ-",URL.Host),"ACCEPTED AUP")<XYZ> where the URL.Host = something.facebook.com. I also want to do two things:


            1) If the URL.Host matches a regex for whatever.facebook.com, write a PD Storage entry for facebook.com

            2) If the URL host matches a regex for whatever.facebook.com, write a PD Storage entry for fbcdn.com


            Then, in my rule where I look for a PDStorage entry for whatever.facebook.com, I want to replace that search with the base domain of facebook.com (since I already wrote that to PDStorage.) and I want to do the same for any other URL.Host values -- something similar to URL.HostBelongsToDomains, but I haven't figured out a way to utilize that particular property for this effort.


            I think I'm getting stuck on the regex for the match for the check against PDStorage. I have PDStorage.AddUserData.String entries that will take whatever.facebook.com and whatever.fbcdn.om and store them as XYZ-facebook.com and XYZ-fbcdn.com, but so far my attempts to get the PDStorage check have resulted in everything but what I want.


            In MWG land, if you wanted to do a regex to match whatever.facebook.com and then do a replace against that value to end up with facebook.com, what's the secret sauce?



            • 3. Re: Coaching + PDStorage

              RegexBuddy to the rescue.



              This will strip off the first section up to the period from whatever.facebook.com and return just facebook.com.


              Set User-Defined.RegexTestOutput = String.ReplaceAllMatches (URL.Host, regex(^.*?\.(.*?)$), "\1")


              This is not as easy as it looks. It only removes the first host off the beginning. This is not always what you want.

              twitter.com is always twitter.com and doesn't have other hosts prepended to it.

              Or even URL shorteners like bit.ly

              1 of 1 people found this helpful
              • 4. Re: Coaching + PDStorage

                So, I went a different route with the regex...




                With this regex, \3 and \4 combined will give me the field data I'm looking for...


                \1: facebook.com


                \3: facebook

                \4: .com


                \1: www.facebook.com

                \2: www.

                \3: facebook

                \4: .com


                I tried replacing with \3\4, but that didn't work.


                I then tried:




                \1: facebook.com


                \3: facebook.com

                \4: facebook

                \5: .com


                \1: www.facebook.com

                \2: www.

                \3: facebook.com

                \4: facebook

                \5: .com


                and tried replacing with \3, but what I got was a match on the value for \4.


                So, for grins, I tried with \2


                <node type="Regex" value="regex(^(.*\.|^)(([\w]{1,50})(.[\w]{2,3})))" node_type="temporary_variable" /><node type="String" value="\2" node_type="temporary_variable" />


                and it matched.


                (Obviously, this won't work for things like whatever.co.uk, but not currently a factor for this particular thing.)


                Thanks again for the assistance!