aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2010-05-23 19:36:12 +0000
committerIgor Sysoev <igor@sysoev.ru>2010-05-23 19:36:12 +0000
commit1a26a18f641f92712f7716b8acbd0d1e73a057ff (patch)
tree69839985be8c1fafb6aa89476ec78e9fd350e46f
parentf5f41265749e76e3e69c87f869628272a21b4d5a (diff)
downloadnginx-1a26a18f641f92712f7716b8acbd0d1e73a057ff.tar.gz
nginx-1a26a18f641f92712f7716b8acbd0d1e73a057ff.zip
autodetect redirect if URI is rewritten to a string starting with $scheme
-rw-r--r--src/http/modules/ngx_http_rewrite_module.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c
index b07eedc78..1a474d9d2 100644
--- a/src/http/modules/ngx_http_rewrite_module.c
+++ b/src/http/modules/ngx_http_rewrite_module.c
@@ -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;