{"id":278,"date":"2006-08-16T22:27:50","date_gmt":"2006-08-17T05:27:50","guid":{"rendered":"http:\/\/strawhousepig.net\/wp\/?p=278"},"modified":"2006-08-16T22:27:50","modified_gmt":"2006-08-17T05:27:50","slug":"block-apache-to-outsiders-using-mod_rewrite","status":"publish","type":"post","link":"https:\/\/strawhousepig.net\/wordpress\/2006\/08\/16\/block-apache-to-outsiders-using-mod_rewrite\/","title":{"rendered":"Block Apache to outsiders using mod_rewrite"},"content":{"rendered":"<p>Most likely vulnerable to something (IP spoofing, anyone?), so use with a grain of salt and close your network instead.<br \/>\n<!--more--><br \/>\nThough I&#8217;m sure its rarely necessary, I&#8217;m going to post this bit of <strong>mod_rewrite<\/strong> magic that took me quite a while to sort out (this is the only syntax that would work for me). What it does is bounce (because I like being a smart-ass) any request made to Apache unless it is made from the local network (subnet\/intranet access only). I figure there has to be a few Mac users sharing their ethernet connection over AirPort. Though I&#8217;m not certain that can be done with PPoE&#8230;<\/p>\n<p>This has not been tested on a server accessible to outsiders, but I&#8217;ll do that before releasing Apache instructions in the final iTunesDSr package.<\/p>\n<p>Open httpd.conf (in the Terminal, type <strong>sudo nano \/etc\/httpd\/httpd.conf<\/strong>, press <strong>Return<\/strong> then enter you password at the prompt and press <strong>Return<\/strong>). Scroll down until you find:<\/p>\n<pre># First, we configure the \"default\" to be a very restrictive set of\n# permissions.\n#<\/pre>\n<p>After those lines, paste this:<\/p>\n<pre>###################################################\n###      Block server from outside traffic      ###\n###################################################\n\nRewriteEngine on\nRewriteCond %{REMOTE_ADDR} !^10\\.\nRewriteRule ^\/(.*) http:\/\/%{REMOTE_ADDR}\/ [L,E=nolog:1]\n\n###################################################<\/pre>\n<p><strong>IMPORTANT:<\/strong> If your subnet IP prefix begins with anything other than <strong>10.<\/strong> (one zero dot) be sure to change the RewriteCond line to reflect that.<\/p>\n<p>Press <strong>Ctrl-x<\/strong>, then  <strong>y<\/strong>, then <strong>Return<\/strong> and restart Apache.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most likely vulnerable to something (IP spoofing, anyone?), so use with a grain of salt and close your network instead.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,7],"tags":[],"class_list":["post-278","post","type-post","status-publish","format-standard","hentry","category-code","category-web"],"_links":{"self":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/comments?post=278"}],"version-history":[{"count":0,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/posts\/278\/revisions"}],"wp:attachment":[{"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/media?parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strawhousepig.net\/wordpress\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}