changeset 2054:989176d3ffc5

auto detect https redirect in rewrite
author Igor Sysoev <igor@sysoev.ru>
date Fri, 20 Jun 2008 14:48:28 +0000
parents dd5ca07f5cdd
children cca975b532bf
files src/http/modules/ngx_http_rewrite_module.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -357,6 +357,12 @@ ngx_http_rewrite(ngx_conf_t *cf, ngx_com
         last = 1;
     }
 
+    if (ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0) {
+        regex->status = NGX_HTTP_MOVED_TEMPORARILY;
+        regex->redirect = 1;
+        last = 1;
+    }
+
     if (cf->args->nelts == 4) {
         if (ngx_strcmp(value[3].data, "last") == 0) {
             last = 1;