map a null/missing variable?
    Ruslan Ermilov 
    ru at nginx.com
       
    Thu Mar 14 05:13:17 UTC 2013
    
    
  
On Wed, Mar 13, 2013 at 02:19:50PM -0400, AJ Weber wrote:
> OK,
> 
> So I'm still working on my caching "issue", but this is a more general 
> question, so for the sake of indexing and helping others in the future 
> with (hopefully) a response...
> 
> How do I use a map to map the lack of a variable/header/cookie (NULL?) 
> to a value?  I can't use "default", because when there IS a value it 
> will be a random set of characters.
You can't handle the lack of a variable (it'll cause a syntax
error in configuration).  Mapping of an unset variable is easy:
map $http_foo $my_var {
    ""      unset;
    default set;
}
> So that said, if a regex like ".+" would work for "any value" and I use 
> 'default' for the NULL, I would try that. :)
That's suboptimal.
    
    
More information about the nginx
mailing list