Merge pull request #1035 from pagespeed/jefftk-script-var-testing
Support script variables in ShardDomain
This commit is contained in:
@@ -284,7 +284,8 @@ const char* NgxRewriteOptions::ParseAndSetOptions(
|
|||||||
!StringCaseEqual(directive, "DownstreamCachePurgeLocationPrefix") &&
|
!StringCaseEqual(directive, "DownstreamCachePurgeLocationPrefix") &&
|
||||||
!StringCaseEqual(directive, "DownstreamCachePurgeMethod") &&
|
!StringCaseEqual(directive, "DownstreamCachePurgeMethod") &&
|
||||||
!StringCaseEqual(directive,
|
!StringCaseEqual(directive,
|
||||||
"DownstreamCacheRewrittenPercentageThreshold")) {
|
"DownstreamCacheRewrittenPercentageThreshold") &&
|
||||||
|
!StringCaseEqual(directive, "ShardDomain")){
|
||||||
compile_scripts = false;
|
compile_scripts = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1153,6 +1153,19 @@ HEADERS="--header=Host:script-filters.example.com"
|
|||||||
OUT=$($WGET_DUMP -S $HEADERS $URL 2>&1)
|
OUT=$($WGET_DUMP -S $HEADERS $URL 2>&1)
|
||||||
check_not_from "$OUT" fgrep -qi 'addInstrumentationInit'
|
check_not_from "$OUT" fgrep -qi 'addInstrumentationInit'
|
||||||
|
|
||||||
|
start_test Test that we can modify domain sharding via script variables.
|
||||||
|
URL="http://$SECONDARY_HOSTNAME/mod_pagespeed_example/rewrite_images.html"
|
||||||
|
HEADERS="--header=Host:script-filters.example.com"
|
||||||
|
OUT=$($WGET_DUMP -S $HEADERS $URL 2>&1)
|
||||||
|
check_from "$OUT" fgrep "http://cdn1.example.com"
|
||||||
|
check_from "$OUT" fgrep "http://cdn2.example.com"
|
||||||
|
|
||||||
|
URL="http://$SECONDARY_HOSTNAME/mod_pagespeed_example/rewrite_images.html"
|
||||||
|
HEADERS="--header=Host:script-filters.example.com --header=X-Script:1"
|
||||||
|
OUT=$($WGET_DUMP -S $HEADERS $URL 2>&1)
|
||||||
|
check_not_from "$OUT" fgrep "http://cdn1.example.com"
|
||||||
|
check_not_from "$OUT" fgrep "http://cdn2.example.com"
|
||||||
|
|
||||||
if [ "$NATIVE_FETCHER" != "on" ]; then
|
if [ "$NATIVE_FETCHER" != "on" ]; then
|
||||||
start_test Test that we can rewrite an HTTPS resource.
|
start_test Test that we can rewrite an HTTPS resource.
|
||||||
fetch_until $TEST_ROOT/https_fetch/https_fetch.html \
|
fetch_until $TEST_ROOT/https_fetch/https_fetch.html \
|
||||||
|
|||||||
@@ -1269,11 +1269,15 @@ http {
|
|||||||
pagespeed FileCachePath "@@FILE_CACHE@@";
|
pagespeed FileCachePath "@@FILE_CACHE@@";
|
||||||
root "@@SERVER_ROOT@@";
|
root "@@SERVER_ROOT@@";
|
||||||
set $filters "";
|
set $filters "";
|
||||||
|
set $domain_shards "cdn1.example.com,cdn2.example.com";
|
||||||
if ($http_X_Script) {
|
if ($http_X_Script) {
|
||||||
set $filters "add_instrumentation";
|
set $filters "add_instrumentation";
|
||||||
|
set $domain_shards "";
|
||||||
}
|
}
|
||||||
pagespeed RewriteLevel PassThrough;
|
pagespeed RewriteLevel PassThrough;
|
||||||
|
pagespeed EnableFilters rewrite_domains;
|
||||||
pagespeed EnableFilters $filters;
|
pagespeed EnableFilters $filters;
|
||||||
|
pagespeed ShardDomain script-filters.example.com "$domain_shards";
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
|
|||||||
Reference in New Issue
Block a user