From be4b668df4bb227760127a24e8e01f1035c4e617 Mon Sep 17 00:00:00 2001 From: Igor Sysoev Date: Thu, 27 Nov 2008 14:13:48 +0000 Subject: [PATCH] r2055 merge: auto detect https redirect in rewrite --- src/http/modules/ngx_http_rewrite_module.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c index 341e05424..249b3201d 100644 --- 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_command_t *cmd, void *conf) 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;