Welcome! Log In Create A New Profile


Using MAP directive

Posted by cisaksen 
Using MAP directive
February 09, 2017 08:48AM
I'm trying to use the "map" directive to test for a set on know ip's as crawlers, to prevent their requests form being logged.

in the http section
map $realip_remote_addr $crawlerip {

default 0; 1; 1; 1;
(not the real ip's of course)

in the server section
location / {

if ($crawlerip = 1) {
access_log off;
<do something>

Not sure if i'm using the directive correctly. Connections are proxied from varnish.

Edited 2 time(s). Last edit at 02/09/2017 08:49AM by cisaksen.
Re: Using MAP directive
February 09, 2017 08:54AM
This will work provided you get the real IP addresses.

nginx for Windows http://nginx-win.ecsds.eu/
Re: Using MAP directive
February 09, 2017 08:59AM
Ok thanks - running nginx on SUSE linux.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 161
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready