diff -r 18428f775b2c src/http/modules/ngx_http_rewrite_module.c
--- a/src/http/modules/ngx_http_rewrite_module.c	Mon Nov 23 12:40:19 2015 +0300
+++ b/src/http/modules/ngx_http_rewrite_module.c	Tue Nov 24 18:51:44 2015 +0100
@@ -748,6 +748,67 @@
             return NGX_CONF_OK;
         }
 
+        if (len == 2 && p[0] == 'l' && p[1] == 't') {
+
+            if (ngx_http_rewrite_value(cf, lcf, &value[last]) != NGX_CONF_OK) {
+                return NGX_CONF_ERROR;
+            }
+
+            code = ngx_http_script_start_code(cf->pool, &lcf->codes,
+                                              sizeof(uintptr_t));
+            if (code == NULL) {
+                return NGX_CONF_ERROR;
+            }
+
+            *code = ngx_http_script_lt_code;
+            return NGX_CONF_OK;
+        }      
+        if (len == 2 && p[0] == 'l' && p[1] == 'e') {
+
+            if (ngx_http_rewrite_value(cf, lcf, &value[last]) != NGX_CONF_OK) {
+                return NGX_CONF_ERROR;
+            }
+
+            code = ngx_http_script_start_code(cf->pool, &lcf->codes,
+                                              sizeof(uintptr_t));
+            if (code == NULL) {
+                return NGX_CONF_ERROR;
+            }
+
+            *code = ngx_http_script_le_code;
+            return NGX_CONF_OK;
+        }      
+        if (len == 2 && p[0] == 'g' && p[1] == 't') {
+
+            if (ngx_http_rewrite_value(cf, lcf, &value[last]) != NGX_CONF_OK) {
+                return NGX_CONF_ERROR;
+            }
+
+            code = ngx_http_script_start_code(cf->pool, &lcf->codes,
+                                              sizeof(uintptr_t));
+            if (code == NULL) {
+                return NGX_CONF_ERROR;
+            }
+
+            *code = ngx_http_script_gt_code;
+            return NGX_CONF_OK;
+        }      
+        if (len == 2 && p[0] == 'g' && p[1] == 'e') {
+
+            if (ngx_http_rewrite_value(cf, lcf, &value[last]) != NGX_CONF_OK) {
+                return NGX_CONF_ERROR;
+            }
+
+            code = ngx_http_script_start_code(cf->pool, &lcf->codes,
+                                              sizeof(uintptr_t));
+            if (code == NULL) {
+                return NGX_CONF_ERROR;
+            }
+
+            *code = ngx_http_script_ge_code;
+            return NGX_CONF_OK;
+        }      
+      
         if ((len == 1 && p[0] == '~')
             || (len == 2 && p[0] == '~' && p[1] == '*')
             || (len == 2 && p[0] == '!' && p[1] == '~')
diff -r 18428f775b2c src/http/ngx_http_script.c
--- a/src/http/ngx_http_script.c	Mon Nov 23 12:40:19 2015 +0300
+++ b/src/http/ngx_http_script.c	Tue Nov 24 18:51:44 2015 +0100
@@ -1466,6 +1466,114 @@
     *res = ngx_http_variable_true_value;
 }
 
+void
+ngx_http_script_lt_code(ngx_http_script_engine_t *e)
+{
+    ngx_http_variable_value_t  *val, *res;
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script lt");
+
+    e->sp--;
+    val = e->sp;
+    res = e->sp - 1;
+
+    e->ip += sizeof(uintptr_t);
+
+    if (val->len >= res->len
+        && ngx_strncmp(val->data, res->data, res->len) > 0)
+    {
+        *res = ngx_http_variable_true_value;
+        return;
+    }
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script lt: no");
+
+    *res = ngx_http_variable_null_value;
+}
+
+void
+ngx_http_script_le_code(ngx_http_script_engine_t *e)
+{
+    ngx_http_variable_value_t  *val, *res;
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script le");
+
+    e->sp--;
+    val = e->sp;
+    res = e->sp - 1;
+
+    e->ip += sizeof(uintptr_t);
+
+    if (val->len >= res->len
+        && ngx_strncmp(val->data, res->data, res->len) >= 0)
+    {
+        *res = ngx_http_variable_true_value;
+        return;
+    }
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script le: no");
+
+    *res = ngx_http_variable_null_value;
+}
+
+void
+ngx_http_script_gt_code(ngx_http_script_engine_t *e)
+{
+    ngx_http_variable_value_t  *val, *res;
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script gt");
+
+    e->sp--;
+    val = e->sp;
+    res = e->sp - 1;
+
+    e->ip += sizeof(uintptr_t);
+
+    if (val->len <= res->len
+        && ngx_strncmp(val->data, res->data, res->len) < 0)
+    {
+        *res = ngx_http_variable_true_value;
+        return;
+    }
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script gt: no");
+
+    *res = ngx_http_variable_null_value;
+}
+
+void
+ngx_http_script_ge_code(ngx_http_script_engine_t *e)
+{
+    ngx_http_variable_value_t  *val, *res;
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script ge");
+
+    e->sp--;
+    val = e->sp;
+    res = e->sp - 1;
+
+    e->ip += sizeof(uintptr_t);
+
+    if (val->len <= res->len
+        && ngx_strncmp(val->data, res->data, res->len) <= 0)
+    {
+        *res = ngx_http_variable_true_value;
+        return;
+    }
+
+    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0,
+                   "http script ge: no");
+
+    *res = ngx_http_variable_null_value;
+}
+
 
 void
 ngx_http_script_file_code(ngx_http_script_engine_t *e)
diff -r 18428f775b2c src/http/ngx_http_script.h
--- a/src/http/ngx_http_script.h	Mon Nov 23 12:40:19 2015 +0300
+++ b/src/http/ngx_http_script.h	Tue Nov 24 18:51:44 2015 +0100
@@ -245,6 +245,10 @@
 void ngx_http_script_if_code(ngx_http_script_engine_t *e);
 void ngx_http_script_equal_code(ngx_http_script_engine_t *e);
 void ngx_http_script_not_equal_code(ngx_http_script_engine_t *e);
+void ngx_http_script_lt_code(ngx_http_script_engine_t *e);
+void ngx_http_script_le_code(ngx_http_script_engine_t *e);
+void ngx_http_script_gt_code(ngx_http_script_engine_t *e);
+void ngx_http_script_ge_code(ngx_http_script_engine_t *e);
 void ngx_http_script_file_code(ngx_http_script_engine_t *e);
 void ngx_http_script_complex_value_code(ngx_http_script_engine_t *e);
 void ngx_http_script_value_code(ngx_http_script_engine_t *e);
