Opened 9 years ago

#838 new enhancement

enable compare operators within if directive

Reported by: elektro-wolle@… Owned by:
Priority: trivial Milestone:
Component: nginx-core Version: 1.9.x
Keywords: Cc:
uname -a: Darwin pong 13.4.0 Darwin Kernel Version 13.4.0: Wed Mar 18 16:20:14 PDT 2015; root:xnu-2422.115.14~1/RELEASE_X86_64 x86_64
nginx -V: nginx version: nginx/1.9.8
built by clang 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
built with OpenSSL 1.0.2d 9 Jul 2015
TLS SNI support enabled
configure arguments: --prefix=/opt/local --conf-path=/opt/local/etc/nginx/nginx.conf --pid-path=/opt/local/var/run/nginx/nginx.pid --error-log-path=/opt/local/var/log/nginx/error.log --http-log-path=/opt/local/var/log/nginx/access.log --with-http_ssl_module

Description

It would be nice to have string comparison operators within the if directive to enable time based redirects/responses like:

  location /foo/ {
    if ($time_iso8601 lt $startTime) {
      return 403 "to early $time_iso8601 $startTime";
    } 
    if ($time_iso8601 gt $endTime) {
      return 403 "to late $time_iso8601 $endTime";
    }
    ...
  }

Attachments (1)

patch-838.diff (6.1 KB ) - added by elektro-wolle@… 9 years ago.
Patch to enable compare operators

Download all attachments as: .zip

Change History (1)

by elektro-wolle@…, 9 years ago

Attachment: patch-838.diff added

Patch to enable compare operators

Note: See TracTickets for help on using tickets.