Skip to content

Commit 0517bbb

Browse files
author
Marius Burkard
committed
- change rewrite rules for redirects to exclude acme challenge dir, fixes #4833
1 parent 44b3dc9 commit 0517bbb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

server/plugins-available/nginx_plugin.inc.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ function update($event_name, $data) {
13271327
$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
13281328
break;
13291329
}
1330-
$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
1330+
$rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/';
13311331
} else { // URL - check if URL is local
13321332
$tmp_redirect_path = $data['new']['redirect_path'];
13331333
if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
@@ -1342,7 +1342,7 @@ function update($event_name, $data) {
13421342
$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
13431343
break;
13441344
} else {
1345-
$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
1345+
$rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/';
13461346
$exclude_own_hostname = $tmp_redirect_path_parts['host'];
13471347
}
13481348
} else {
@@ -1377,7 +1377,7 @@ function update($event_name, $data) {
13771377
$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
13781378
break;
13791379
}
1380-
$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
1380+
$rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/';
13811381
} else { // URL - check if URL is local
13821382
$tmp_redirect_path = $data['new']['redirect_path'];
13831383
if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
@@ -1394,7 +1394,7 @@ function update($event_name, $data) {
13941394
$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
13951395
break;
13961396
} else {
1397-
$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
1397+
$rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/';
13981398
$exclude_own_hostname = $tmp_redirect_path_parts['host'];
13991399
}
14001400
} else {
@@ -1429,7 +1429,7 @@ function update($event_name, $data) {
14291429
$vhost_data['web_document_root_www'] .= substr($data['new']['redirect_path'], 0, -1);
14301430
break;
14311431
}
1432-
$rewrite_exclude = '(?!/\b('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
1432+
$rewrite_exclude = '(?!/('.substr($data['new']['redirect_path'], 1, -1).(substr($data['new']['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/';
14331433
} else { // URL - check if URL is local
14341434
$tmp_redirect_path = $data['new']['redirect_path'];
14351435
if(substr($tmp_redirect_path, 0, 7) == '$scheme') $tmp_redirect_path = 'http'.substr($tmp_redirect_path, 7);
@@ -1444,7 +1444,7 @@ function update($event_name, $data) {
14441444
$vhost_data['web_document_root_www'] .= $tmp_redirect_path_parts['path'];
14451445
break;
14461446
} else {
1447-
$rewrite_exclude = '(?!/\b('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
1447+
$rewrite_exclude = '(?!/('.substr($tmp_redirect_path_parts['path'], 1).(substr($tmp_redirect_path_parts['path'], 1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/';
14481448
$exclude_own_hostname = $tmp_redirect_path_parts['host'];
14491449
}
14501450
} else {
@@ -1560,7 +1560,7 @@ function update($event_name, $data) {
15601560
// Local Rewriting (inside vhost server {} container)
15611561
if($alias['redirect_type'] != '' && substr($alias['redirect_path'], 0, 1) == '/' && $alias['redirect_type'] != 'proxy') { // proxy makes no sense with local path
15621562
if(substr($alias['redirect_path'], -1) != '/') $alias['redirect_path'] .= '/';
1563-
$rewrite_exclude = '(?!/\b('.substr($alias['redirect_path'], 1, -1).(substr($alias['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').')\b)/';
1563+
$rewrite_exclude = '(?!/('.substr($alias['redirect_path'], 1, -1).(substr($alias['redirect_path'], 1, -1) != ''? '|': '').'stats'.($vhost_data['errordocs'] == 1 ? '|error' : '').'|\.well-known/acme-challenge))/';
15641564
switch($alias['subdomain']) {
15651565
case 'www':
15661566
// example.com

0 commit comments

Comments
 (0)