]> git.kaiwu.me - nginx.git/commitdiff
autodetect redirect if URI is rewritten to a string starting with $scheme
authorIgor Sysoev <igor@sysoev.ru>
Sun, 23 May 2010 19:36:12 +0000 (19:36 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 23 May 2010 19:36:12 +0000 (19:36 +0000)
src/http/modules/ngx_http_rewrite_module.c

index b07eedc78dde533ac4826b25411c354d871b70f8..1a474d9d266e714349af684e2a8771f5204fdeca 100644 (file)
@@ -341,13 +341,10 @@ ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 
     last = 0;
 
-    if (ngx_strncmp(value[2].data, "http://", sizeof("http://") - 1) == 0) {
-        regex->status = NGX_HTTP_MOVED_TEMPORARILY;
-        regex->redirect = 1;
-        last = 1;
-    }
-
-    if (ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0) {
+    if (ngx_strncmp(value[2].data, "http://", sizeof("http://") - 1) == 0
+        || ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0
+        || ngx_strncmp(value[2].data, "$scheme", sizeof("$scheme") - 1) == 0)
+    {
         regex->status = NGX_HTTP_MOVED_TEMPORARILY;
         regex->redirect = 1;
         last = 1;