<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">If you can dump your http traffic you will probably see a headers with names like:<div>X-Real-IP</div><div>X-Forwarded-For<br><br><div id="AppleMailSignature">Sent from my iPhone</div><div><br>On May 23, 2018, at 11:25 PM, Frank Liu <<a href="mailto:gfrankliu@gmail.com">gfrankliu@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Since only load balancer sees the client IP, it has to pass that information to nginx. You need to talk to your LB engineer and depending on the type of LB, there are different ways to do that. Once the information is passed to nginx, nginx will expose it as a variable, which can then be used by the geoip2 module to do the lookup and create country code for you to use for blocking.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 23, 2018 at 6:51 PM, Sathish Kumar <span dir="ltr"><<a href="mailto:satcse88@gmail.com" target="_blank">satcse88@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><span style="font-family:helvetica;font-size:medium">How can I get the client IP address if the request is coming through load balancer or Proxy and pass it to default nginx geoip module to block it based on the Country.</span><br></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Tue, May 22, 2018, 4:45 PM Frank Liu <<a href="mailto:gfrankliu@gmail.com" target="_blank">gfrankliu@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">Instead of the default nginx geoip module , I suggest you switch to third party geoip2 module for two reasons:</div><div dir="auto">1) maxmind deprecated geoip1 db.</div><div dir="auto">2)geoip2 module can do what you wanted, and the geo lookup can be based on any variables, such as $http_x_forwarded_for</div><div dir="auto"> Frank</div><br><div class="gmail_quote"><div>On Mon, May 21, 2018 at 6:37 PM Sathish Kumar <<a href="mailto:satcse88@gmail.com" rel="noreferrer" target="_blank">satcse88@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Hi All,<div dir="auto"><br></div><div dir="auto">Is there a way, I can block the clients which is coming through load balancer using http geo ip module nginx.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Currently, I can block the clients which is not coming through load balancer or api gateway by geo ip module.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div></div><br><div class="gmail_quote"><div>On Mon, May 21, 2018, 2:02 PM basti <<a href="mailto:mailinglist@unix-solution.de" rel="noreferrer" target="_blank">mailinglist@unix-solution.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hello,<br>
the way to block ip's can also be used for PTR records, I think.<br>
Also as wildcard.<br>
<br>
On 21.05.2018 05:49, Sathish Kumar wrote:<br>
> Hi All,<br>
> <br>
> I have a requirement to block certain countries coming to our website. <br>
> I managed to achieved it using the ngx_http_geoip_module. I have a<br>
> problem now, if the request comes through Amazon API Gateway, how can I<br>
> read the X-forwarded-for header or block these request too.<br>
> <br>
> nginx.conf<br>
> map $geoip_country_code $allow_country {<br>
>  default yes; <br>
> SG no; <br>
> }<br>
> <br>
> <br>
> geoip_country /etc/nginx/GeoIP.dat; # the country IP database <br>
> geoip_city /etc/nginx/GeoLiteCity.dat; # the city IP database<br>
> <br>
> <br>
> domain.conf<br>
> if ($allow_country = no) { <br>
> return 444; <br>
> }<br>
> <br>
> Thanks & Regards<br>
> Sathish.V<br>
> <br>
> <br>
> ______________________________<wbr>_________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org" rel="noreferrer noreferrer" target="_blank">nginx@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br>
> <br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" rel="noreferrer noreferrer" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a></blockquote></div>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" rel="noreferrer" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a></blockquote></div></div>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" rel="noreferrer" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a></blockquote></div>
</div></div><br>______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>nginx mailing list</span><br><span><a href="mailto:nginx@nginx.org">nginx@nginx.org</a></span><br><span><a href="http://mailman.nginx.org/mailman/listinfo/nginx">http://mailman.nginx.org/mailman/listinfo/nginx</a></span></div></blockquote></div></body></html>