Mobile app version of vmapp.org
Login or Join
Debbie626

: Nginx negating condition/ if else I've came into situation where I cannot find a way around it, neither with tons googling. valid_referers none blocked something.com; if ($invalid_referer) {

@Debbie626

Posted in: #Configuration #Nginx

I've came into situation where I cannot find a way around it, neither with tons googling.

valid_referers none blocked something.com;
if ($invalid_referer) {
rewrite ^ /leech.jpg;
expires epoch;
}


Everything works fine so far, but I want to create if referer is valid to expire max; I couldn't find how to negate if statement or create else in nginx configuration. I tried:

else {
expires max;
}


or (notice exclamation mark)

if(!$invalid_referer){
expires max;
}


but it doesn't work as it works in almost everywhere.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Debbie626

1 Comments

Sorted by latest first Latest Oldest Best

 

@Barnes591

Try to make one setting default and other one turned on by condition:

expires max;

valid_referers none blocked something.com;
if ($invalid_referer) {
rewrite ^ /leech.jpg;
expires epoch;
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme