Nginx Map how to check value if empty

c0nw0nk nginx-forum at forum.nginx.org
Sat Mar 4 22:35:21 UTC 2017


Thank's Francis much appreciated it seems to be working good :)

Francis Daly Wrote:
-------------------------------------------------------
> On Fri, Mar 03, 2017 at 10:47:26AM -0500, c0nw0nk wrote:
> 
> Hi there,
> 
> > map $http_cf_connecting_ip $client_ip_from_cf {
> > default $http_cf_connecting_ip;
> > }
> > 
> > How can I make it so if the client did not send that $http_ header
> it makes
> > $client_ip_from_cf variable value = $binary_remote_addr
> > 
> > Not sure how to check in a map if that http header is present.
> 
> If the http header is absent, the matching variable is empty. So it
> will
> have the value "".
> 
> Use that as the first half of your "map" pair.
> 
> 	f
> -- 
> Francis Daly        francis at daoine.org
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,272744,272759#msg-272759



More information about the nginx mailing list