summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBOA Dev Team2019-01-09 15:48:39 (GMT)
committerBOA Dev Team2019-01-09 15:48:39 (GMT)
commit2eba01158578f7bae8697a4eeb0ae02b5e2c195e (patch)
tree852c50b528f051ae2d6b64051768e1e36fc05459
parent98216d3cbac744debf62689664959099b1d14ae5 (diff)
Issue #3024748 - Nginx config for D8 conflicts with Rewrite module
You will notice that we have tested the Drupal 8 compatible configuration with Drupal 7, but it didn’t work for various Ajax based requests, like auto-update of tasks list in Aegir, hence the NotForD7 keyword left, and we are still using the legacy D6 compatible format for D7 as before, while new format is used only for Drupal 8.
-rw-r--r--http/Provision/Config/Nginx/Inc/vhost_include.tpl.php80
1 files changed, 25 insertions, 55 deletions
diff --git a/http/Provision/Config/Nginx/Inc/vhost_include.tpl.php b/http/Provision/Config/Nginx/Inc/vhost_include.tpl.php
index 28fb0bf..ca4656a 100644
--- a/http/Provision/Config/Nginx/Inc/vhost_include.tpl.php
+++ b/http/Provision/Config/Nginx/Inc/vhost_include.tpl.php
@@ -170,7 +170,7 @@ location ^~ /httprl_async_function_callback {
location ~* ^/httprl_async_function_callback {
access_log off;
set $nocache_details "Skip";
- try_files $uri @nobots;
+ try_files $uri @drupal;
}
}
@@ -181,7 +181,7 @@ location ^~ /admin/httprl-test {
location ~* ^/admin/httprl-test {
access_log off;
set $nocache_details "Skip";
- try_files $uri @nobots;
+ try_files $uri @drupal;
}
}
@@ -209,7 +209,7 @@ location ^~ /cdn/farfuture/ {
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
rewrite ^/cdn/farfuture/[^/]+/[^/]+/(.+)$ /$1 break;
- try_files $uri @nobots;
+ try_files $uri @drupal;
}
location ~* ^/cdn/farfuture/ {
expires epoch;
@@ -219,9 +219,9 @@ location ^~ /cdn/farfuture/ {
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
rewrite ^/cdn/farfuture/[^/]+/[^/]+/(.+)$ /$1 break;
- try_files $uri @nobots;
+ try_files $uri @drupal;
}
- try_files $uri @nobots;
+ try_files $uri @drupal;
}
<?php endif; ?>
@@ -335,7 +335,7 @@ location ^~ /search {
if ($is_bot) {
return 403;
}
- try_files $uri @cache;
+ try_files $uri @drupal;
}
}
@@ -423,7 +423,7 @@ location ^~ /hosting {
}
access_log off;
set $nocache_details "Skip";
- try_files $uri @cache;
+ try_files $uri @drupal;
}
<?php if ($satellite_mode == 'boa'): ?>
@@ -546,7 +546,7 @@ location ~* (?:validation|aggregator|vote_up_down|captcha|vbulletin|glossary/) {
return 403;
}
access_log off;
- try_files $uri @cache;
+ try_files $uri @drupal;
}
###
@@ -737,7 +737,7 @@ location ~* files/advagg_(?:css|js)/ {
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
set $nocache_details "Skip";
- try_files $uri @nobots;
+ try_files $uri @drupal;
}
###
@@ -1063,7 +1063,7 @@ location ~* /(?:ahah|ajax|batch|autocomplete|done|progress/|x-progress-id|js/.*)
log_not_found off;
<?php if ($nginx_config_mode == 'extended'): ?>
set $nocache_details "Skip";
- try_files $uri @nobots;
+ try_files $uri @drupal;
<?php else: ?>
try_files $uri @drupal;
<?php endif; ?>
@@ -1311,63 +1311,32 @@ location @cache {
### Send all not cached requests to drupal with clean URLs support.
###
location @drupal {
-<?php if ($nginx_config_mode == 'extended'): ?>
- error_page 418 = @nobots;
- if ($args) {
- return 418;
- }
-<?php endif; ?>
+ set $core_detected "Legacy";
###
### For Drupal >= 7
###
- if ($sent_http_x_generator) {
- add_header X-Info-Gen "Modern";
- rewrite ^ /index.php?$query_string last;
+ if ( -e $document_root/web.config ) {
+ set $core_detected "Regular";
+ }
+ if ( -e $document_root/core ) {
+ set $core_detected "Modern";
+ }
+ error_page 418 = @modern;
+ if ( $core_detected ~ (?:NotForD7|Modern) ) {
+ return 418;
}
###
- ### For Drupal <= 6
+ ### For Drupal 6
###
rewrite ^/(.*)$ /index.php?q=$1 last;
}
<?php if ($nginx_config_mode == 'extended'): ?>
###
-### Special location for bots custom restrictions; can be overridden.
-###
-location @nobots {
+### Special location for Drupal 7+.
###
- ### Support for Accelerated Mobile Pages (AMP) when bots are redirected below
- ###
- # if ( $query_string ~ "^amp$" ) {
- # rewrite ^/(.*)$ /index.php?q=$1 last;
- # }
-
- ###
- ### Send all known bots to $args free URLs (optional)
- ###
- # if ($is_bot) {
- # return 301 $scheme://$host$request_uri;
- # }
-
- ###
- ### Return 404 on special PHP URLs to avoid revealing version used,
- ### even indirectly. See also: https://drupal.org/node/2116387
- ###
- if ( $args ~* "=PHP[A-Z0-9]{8}-" ) {
- return 404;
- }
-
- ###
- ### For Drupal >= 7
- ###
- if ($sent_http_x_generator) {
- add_header X-Info-Gen "Modern";
- rewrite ^ /index.php?$query_string last;
- }
- ###
- ### For Drupal <= 6
- ###
- rewrite ^/(.*)$ /index.php?q=$1 last;
+location @modern {
+ try_files $uri /index.php?$query_string;
}
###
@@ -1381,6 +1350,7 @@ location = /index.php {
add_header X-GeoIP-Country-Name "$geoip_country_name";
<?php endif; ?>
<?php if ($nginx_config_mode == 'extended'): ?>
+ add_header X-Core-Variant "$core_detected";
add_header X-Speed-Cache "$upstream_cache_status";
add_header X-Speed-Cache-UID "$cache_uid";
add_header X-Speed-Cache-Key "$key_uri";