<html><head><meta http-equiv="Content-Security-Policy" content="script-src 'self'; img-src * cid: data:;"><style id="outgoing-font-settings">#response_container_BBPPID{font-family: initial; font-size:initial; color: initial;}</style></head><body style="background-color: rgb(255, 255, 255); background-image: initial; line-height: initial;"><div id="response_container_BBPPID" style="outline:none;" dir="auto" contenteditable="false"> <div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width:100%;"> Perhaps a dumb question, but if all you are going to do is return a 403, why not just do this filtering in the firewall by blocking the offending IP space. Yeah I know a server should always have some response, but it isn't like you would be the first person to just block entire countries. (I don't do this on 80/443, but I do block most email ports outside the US.) </div><div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width:100%;"><br></div><div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width:100%;">The only reason I mention this is Nginx blocking is more CPU intensive than the firewall.  On a small VPS, you might notice the difference in loadomg.</div><div name="BB10" id="BB10_response_div_BBPPID" dir="auto" style="width:100%;"><br></div>                                                                                                                                      <div name="BB10" id="response_div_spacer_BBPPID" dir="auto" style="width:100%;"> <br style="display:initial"></div>                            <div id="blackberry_signature_BBPPID" name="BB10" dir="auto">     <div id="_signaturePlaceholder_BBPPID" name="BB10" dir="auto"></div> </div></div><div id="_original_msg_header_BBPPID" dir="auto">                                                                                                                                             <table width="100%" style="background-color: white; border-spacing: 0px; display: table; outline: none;" contenteditable="false"><tbody><tr><td colspan="2" style="padding: initial; font-size: initial; text-align: initial; background-color: rgb(255, 255, 255);">                           <div style="border-right: none; border-bottom: none; border-left: none; border-image: initial; border-top: 1pt solid rgb(181, 196, 223); padding: 3pt 0in 0in; font-family: Tahoma, "BB Alpha Sans", "Slate Pro"; font-size: 10pt;">  <div id="from"><b>From:</b> softwareinfojam@gmail.com</div><div id="sent"><b>Sent:</b> April 12, 2019 7:24 PM</div><div id="to"><b>To:</b> nginx@nginx.org</div><div id="reply_to"><b>Reply-to:</b> nginx@nginx.org</div><div id="subject"><b>Subject:</b> </div></div></td></tr></tbody></table> <br> </div><!--start of _originalContent --><div name="BB10" dir="auto" style="background-image: initial; line-height: initial; outline: none;" contenteditable="false"><div id="ssc11652"><style>#ssc11652 p.MsoNormal,#ssc11652 li.MsoNormal,#ssc11652 div.MsoNormal{margin: 0in;margin-bottom: 1.0E-4pt;font-size: 11pt;font-family: "Calibri", sans-serif;}#ssc11652 a:link,#ssc11652 span.MsoHyperlink{color: blue;text-decoration: underline;}#ssc11652 a:visited,#ssc11652 span.MsoHyperlinkFollowed{color: rgb(149, 79, 114);text-decoration: underline;}#ssc11652 .MsoChpDefault{}#ssc11652 div.WordSection1{}</style><div><div class="WordSection1"><p class="MsoNormal">Hi All</p><p class="MsoNormal">I have implemented GEO IP blocking which is working just fine. I have the settings you see below. </p><p class="MsoNormal"> </p><p class="MsoNormal">    map $geoip_country_code $country_access {<!-- --></p><p class="MsoNormal">        "US"    0;</p><p class="MsoNormal">        default 1;</p><p class="MsoNormal">    }</p><p class="MsoNormal"> </p><p class="MsoNormal">    server {<!-- --></p><p class="MsoNormal">         if ($country_access = '1') {<!-- --></p><p class="MsoNormal">         return 403;</p><p class="MsoNormal">         }</p><p class="MsoNormal"> </p><p class="MsoNormal">I notice though that in the logs, the internal IP Addresses are not tagged with a country code so internal subnets are getting blocked. Would the correct solution be to enter the subnets manually such as this config below? Or is there a better solution? Oh by the way, I did try this below and it didn’t work. Trying to keep the Geographical blocking but allow some IP ranges. Any ideas on how to do this? Any help would be appreciated.</p><p class="MsoNormal">   </p><p class="MsoNormal"> map $geoip_country_code $country_access {<!-- --></p><p class="MsoNormal">        "US"    0;</p><p class="MsoNormal">       <b>‘<wbr><a href="http://192.168.1.0/24">192.168.1.0/24</a><wbr>’ 0</b>;</p><p class="MsoNormal">        default 1;</p><p class="MsoNormal">    }</p><p class="MsoNormal"> </p><p class="MsoNormal"> </p><p class="MsoNormal">Regards</p><p class="MsoNormal">SI</p><p class="MsoNormal"> </p><p class="MsoNormal"> </p></div></div></div><!--end of _originalContent --></div></body></html>