baptx

moz-rewrite block referer for Twitter external domains

Oct 14th, 2015
161
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. [
  2.     {
  3.         "url" : /^.*$/, // if request going to any domain
  4.         "headers" : function() {
  5.             var headers = {};
  6.             // block referer for request coming from any domain except twitter.com
  7.             if (request.window_location.host != "twitter.com")
  8.             {
  9.                 headers = {
  10.                     "Referer" : null
  11.                 };
  12.             }
  13.             return headers;
  14.         }
  15.     },
  16.     {
  17.         "url" : /^(?!https:\/\/twitter.com\/).*$/, // if request going to other domain than twitter.com
  18.         "headers" : function() {
  19.             var headers = {};
  20.             if (request.window_location.host == "twitter.com") // block referer for request coming from twitter.com
  21.             {
  22.                 headers = {
  23.                     "Referer" : null
  24.                 };
  25.             }
  26.             return headers;
  27.         }
  28.     }
  29. ]
RAW Paste Data