Somebody
Somebody

Reputation: 9645

Nginx: conditional "expires" directive

I wanted to create if block for expires directive, but it's not allowed in if context.

Like that:

if($args ~ "no_caching=1") {
  expires      epoch;
}

Is it somehow possible to create this in any other way?

I need nginx to change expire header to epoch when simple $_GET param no_cache=1 is in present.

For visual checking purposes.

Thanks ;)

Upvotes: 0

Views: 1240

Answers (1)

MTeck
MTeck

Reputation: 1688

if ($arg_no_caching = 1) {
    expires max;
}

http://wiki.nginx.org/HttpCoreModule#.24arg_PARAMETER

Upvotes: 3

Related Questions