Compare commits

...

26 Commits

Author SHA1 Message Date
Jeff Kaufman 634bf52a1a trunk-tracking: update from r3924 to r3934
There aren't actually any changes required from r3924 to r3934 but the admin
work from previous versions wasn't completely ported before.

This change:
 * adds support for /pagespeed_admin and /pagespeed_global_admin
 * removes NgxPagespeedConsoleAsyncFetch using NgxBaseFetch instead
 * adds options StatisticsPath, GlobalStatisticsPath, ConsolePath,
   MessagesPath, AdminPath, and GlobalAdminPath which allow site owners to
   control what path these are served under
 * changes /ngx_pagespeed_statistics etc from default-on to default-off,
   requiring explicit path configuration to function
 * does not fix the problem where trunk-tracking fails tests on 1.5 post #653
2014-04-16 14:41:16 -04:00
Jeff Kaufman 5d5e3cb366 trunk-tracking: merge in master 2014-04-11 15:17:25 -04:00
Otto van der Schaaf 323e820fde Merge pull request #658 from pagespeed/oschaaf-configure-wnoerror
nginx-gridfs: Add configure option to build with wno-error
2014-04-09 20:38:57 +02:00
Otto van der Schaaf 7d72a7c89a nginx-gridfs: Add configure option to build with wno-error
Some modules add things to CFLAGS that will make ngx_pagespeed emit
warnings at compile time. For example, nginx-gridfs will add
`--std=c99` - which is no good for ngx_pagespeed.

@peterbowey mentioned that -wno-error fixes the build -- so
to work around, make configure add `-wno-error` when used like
this: `WNO_ERROR=YES ./configure`
On my system, that results in a succesfull build when nginx-gridfs
is added to the module mix.

Fixes https://github.com/pagespeed/ngx_pagespeed/issues/626
2014-04-08 13:10:58 +02:00
Jeff Kaufman 6ced8c0f65 Merge pull request #641 from pagespeed/jefftk-if-block
if: support pagespeed directives in location if blocks
2014-03-25 13:16:27 -04:00
Jeff Kaufman 78cf39f9b3 if: support pagespeed directives in location if blocks 2014-03-19 16:46:48 -04:00
Jeff Kaufman f25569690a merge commit: merge 1.7.30.4 into master 2014-03-14 10:15:42 -04:00
huibaolin 707d671826 Change version 1.7.30.3 to 1.7.30.4 2014-03-14 08:16:38 -04:00
Jeff Kaufman f8b87ea436 Merge pull request #636 from pagespeed/huibao-prepare-1.7.30.4-release
release: update version number 1.7.30.3 to 1.7.30.4
2014-03-13 10:37:21 -04:00
Huibao Lin 86d840f76e release: udpate version number 1.7.30.3 to 1.7.30.4 2014-03-13 10:27:21 -04:00
Jeff Kaufman 0110d33fa7 Merge pull request #635 from pagespeed/huibao-prepare-1.7.30.4-release
release: build against backported change
2014-03-13 10:26:16 -04:00
Huibao Lin 497594ba7f release: build against backported change 2014-03-13 10:18:57 -04:00
Jeff Kaufman 336352df38 Merge pull request #633 from pnommensen/patch-2
readme: use nginx 1.4.6
2014-03-07 13:17:42 -05:00
Patrick Nommensen 0edd405eb8 Update README.md
Don't know how I missed that.
2014-03-07 10:16:43 -08:00
Jeff Kaufman d004c4d916 Merge pull request #632 from pnommensen/patch-2
1.4.5 to 1.4.6 update
2014-03-07 11:32:01 -05:00
Patrick Nommensen 091ef6399b version update
1.4.5 to 1.4.6 http://nginx.org/en/CHANGES-1.4
2014-03-06 23:25:13 -08:00
Jeff Kaufman 9699caeab5 Merge pull request #623 from pnommensen/patch-1
Update README.md
2014-02-20 09:12:04 -05:00
Patrick Nommensen c371d516a8 Update README.md
nginx version update
2014-02-20 00:04:21 -08:00
Jeff Kaufman bf6c6c0e9b Merge pull request #621 from jart/dont-chown
Security Fix: Don't call chown() unless necessary.
2014-02-18 14:32:32 -05:00
Justine Tunney e8dd9fd3c3 Don't call chown() when initializing config dirs unless owner != worker user. 2014-02-15 22:32:55 -05:00
Jeff Kaufman 64eaa2a659 Merge pull request #602 from tcpper/fix_ngx_fetch_content_length
fix bug in NgxFetch#content_length_
2014-01-30 11:25:52 -08:00
huibaolin 6db4d02a91 Merge pull request #600 from pagespeed/huibao-prepare-release-1.7.30.3-beta
release: prepare 1.7.30.3
2014-01-16 12:12:53 -08:00
Huibao Lin 1354cee4ed release: prepare 1.7.30.3 2014-01-16 15:06:49 -05:00
tcpper 6ccb815df3 fix bug in NgxFetch#content_length_ 2014-01-16 21:06:12 +08:00
Jeff Kaufman 72ddb34a1c readme: release 1.7.30.2 2014-01-06 16:54:56 -05:00
Jeff Kaufman ae2d4bac7f native-fetcher: fix to work with nginx 1.5.8+
nginx 1.5.8 changed the resolver api, which the native fetcher uses.

Fixes #578.

Squash-merge of @dinic's #581.
2014-01-06 16:46:48 -05:00
7 changed files with 233 additions and 112 deletions
+4
View File
@@ -109,6 +109,10 @@ case "$NGX_GCC_VER" in
;;
esac
if [ "$WNO_ERROR" = "YES" ]; then
CFLAGS="$CFLAGS -Wno-error"
fi
pagespeed_include="\
$mod_pagespeed_dir \
$mod_pagespeed_dir/third_party/chromium/src \
+5 -5
View File
@@ -72,11 +72,11 @@ namespace net_instaweb {
done_(false),
content_length_(-1),
content_length_known_(false) {
ngx_memzero(&url_, sizeof(url_));
log_ = log;
pool_ = NULL;
timeout_event_ = NULL;
connection_ = NULL;
ngx_memzero(&url_, sizeof(url_));
log_ = log;
pool_ = NULL;
timeout_event_ = NULL;
connection_ = NULL;
}
NgxFetch::~NgxFetch() {
+78 -65
View File
@@ -290,7 +290,7 @@ ngx_int_t copy_response_headers_to_ngx(
StringCaseEqual(name_gs, "Last-Modified") ||
StringCaseEqual(name_gs, "Cache-Control")) {
continue;
}
}
} else if (preserve_caching_headers == kPreserveOnlyCacheControl) {
// Retain the original Cache-Control header, but send the recomputed
// values for all other cache-related headers.
@@ -299,7 +299,7 @@ ngx_int_t copy_response_headers_to_ngx(
StringCaseEqual(name_gs, "Date") ||
StringCaseEqual(name_gs, "Last-Modified")) {
continue;
}
}
} // else we don't preserve any headers
ngx_str_t name, value;
@@ -441,8 +441,11 @@ enum Response {
kPagespeedDisabled,
kBeacon,
kStatistics,
kGlobalStatistics,
kConsole,
kMessages,
kAdmin,
kGlobalAdmin,
kPagespeedSubrequest,
kNotHeadOrGet,
kErrorResponse,
@@ -1567,16 +1570,26 @@ RequestRouting::Response ps_route_request(ngx_http_request_t* r,
} else if (url.PathSansLeaf() ==
NgxRewriteDriverFactory::kStaticAssetPrefix) {
return RequestRouting::kStaticContent;
} else if (url.PathSansQuery() == "/ngx_pagespeed_statistics" ||
url.PathSansQuery() == "/ngx_pagespeed_global_statistics" ) {
return RequestRouting::kStatistics;
} else if (url.PathSansQuery() == "/pagespeed_console") {
return RequestRouting::kConsole;
} else if (url.PathSansQuery() == "/ngx_pagespeed_message") {
return RequestRouting::kMessages;
}
RewriteOptions* global_options = cfg_s->server_context->global_options();
NgxRewriteOptions* global_options = cfg_s->server_context->config();
StringPiece path = url.PathSansQuery();
if (path == global_options->statistics_path()) {
return RequestRouting::kStatistics;
} else if (path == global_options->global_statistics_path()) {
return RequestRouting::kGlobalStatistics;
} else if (path == global_options->console_path()) {
return RequestRouting::kConsole;
} else if (path == global_options->messages_path()) {
return RequestRouting::kMessages;
} else if (!global_options->admin_path().empty() &&
path.starts_with(global_options->admin_path())) {
return RequestRouting::kAdmin;
} else if (!global_options->global_admin_path().empty() &&
path.starts_with(global_options->global_admin_path())) {
return RequestRouting::kGlobalAdmin;
}
const GoogleString* beacon_url;
if (ps_is_https(r)) {
@@ -1592,7 +1605,9 @@ RequestRouting::Response ps_route_request(ngx_http_request_t* r,
return RequestRouting::kResource;
}
ngx_int_t ps_resource_handler(ngx_http_request_t* r, bool html_rewrite) {
ngx_int_t ps_resource_handler(ngx_http_request_t* r,
bool html_rewrite,
RequestRouting::Response response_category) {
if (r != r->main) {
return NGX_DECLINED;
}
@@ -1653,6 +1668,12 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r, bool html_rewrite) {
bool pagespeed_resource =
!html_rewrite && cfg_s->server_context->IsPagespeedResource(url);
bool is_an_admin_handler =
response_category == RequestRouting::kStatistics ||
response_category == RequestRouting::kGlobalStatistics ||
response_category == RequestRouting::kConsole ||
response_category == RequestRouting::kAdmin ||
response_category == RequestRouting::kGlobalAdmin;
if (html_rewrite) {
ps_release_base_fetch(ctx);
@@ -1678,7 +1699,7 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r, bool html_rewrite) {
// Downstream cache integration is not enabled. Disable original
// Cache-Control headers.
ctx->preserve_caching_headers = kDontPreserveHeaders;
} else if (!pagespeed_resource) {
} else if (!pagespeed_resource && !is_an_admin_handler) {
ctx->preserve_caching_headers = kPreserveOnlyCacheControl;
// Downstream cache integration is enabled. If a rebeaconing key has been
// configured and there is a ShouldBeacon header with the correct key,
@@ -1732,6 +1753,42 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r, bool html_rewrite) {
custom_options.release() /* null if there aren't custom options */,
false /* using_spdy */, cfg_s->server_context, ctx->base_fetch);
return ps_async_wait_response(r);
} else if (is_an_admin_handler) {
QueryParams query_params;
query_params.Parse(url.Query());
PosixTimer timer;
int64 now_ms = timer.NowMs();
ctx->base_fetch->response_headers()->SetDateAndCaching(
now_ms, 0 /* max-age */, ", no-cache");
if (response_category == RequestRouting::kStatistics ||
response_category == RequestRouting::kGlobalStatistics) {
cfg_s->server_context->StatisticsPage(
response_category == RequestRouting::kGlobalStatistics,
query_params,
cfg_s->server_context->config(),
ctx->base_fetch);
} else if (response_category == RequestRouting::kConsole) {
cfg_s->server_context->ConsoleHandler(
*cfg_s->server_context->config(),
SystemServerContext::kStatistics,
query_params,
ctx->base_fetch);
} else if (response_category == RequestRouting::kAdmin ||
response_category == RequestRouting::kGlobalAdmin) {
cfg_s->server_context->AdminPage(
response_category == RequestRouting::kGlobalAdmin,
url,
query_params,
custom_options == NULL ? cfg_s->server_context->config()
: custom_options.get(),
ctx->base_fetch);
} else {
CHECK(false);
}
return ps_async_wait_response(r);
}
if (html_rewrite) {
@@ -2038,7 +2095,8 @@ ngx_int_t ps_html_rewrite_header_filter(ngx_http_request_t* r) {
return ngx_http_next_header_filter(r);
}
ngx_int_t rc = ps_resource_handler(r, true /* html rewrite */);
ngx_int_t rc = ps_resource_handler(r, true /* html rewrite */,
RequestRouting::kResource);
if (rc != NGX_OK) {
ctx->html_rewrite = false;
return ngx_http_next_header_filter(r);
@@ -2320,27 +2378,6 @@ ngx_int_t send_out_headers_and_body(
return ngx_http_output_filter(r, out);
}
namespace {
// TODO(jefftk): This class is a temporary shim to just support console fetch,
// but we eventually want to convert everything in ps_simple_handler to use
// something akin to NgxBaseFetch (which sends results direct to nginx). This
// is work in progress (but well along) in the mod_pagespeed world.
class NgxPagespeedConsoleAsyncFetch : public AsyncFetchUsingWriter {
public:
NgxPagespeedConsoleAsyncFetch(const RequestContextPtr& request_context,
Writer* writer)
: AsyncFetchUsingWriter(request_context, writer) { }
virtual void HandleDone(bool status) { }
virtual void HandleHeadersComplete() { }
void FlushToNgx(const GoogleString& output, ngx_http_request_t* r) {
send_out_headers_and_body(r, *response_headers(), output);
}
};
} // namespace
ngx_int_t ps_simple_handler(ngx_http_request_t* r,
NgxServerContext* server_context,
RequestRouting::Response response_category) {
@@ -2376,34 +2413,6 @@ ngx_int_t ps_simple_handler(ngx_http_request_t* r,
file_contents.CopyToString(&output);
break;
}
case RequestRouting::kStatistics: {
bool is_global_request =
StringCaseStartsWith(
request_uri_path, "/ngx_pagespeed_global_statistics");
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
RequestContextPtr request_context(
cfg_s->server_context->NewRequestContext(r));
NgxPagespeedConsoleAsyncFetch fetch(request_context, &writer);
server_context->StatisticsPage(
is_global_request,
query_params,
cfg_s->server_context->global_options(),
&fetch);
fetch.FlushToNgx(output, r);
return NGX_OK;
}
case RequestRouting::kConsole: {
ps_srv_conf_t* cfg_s = ps_get_srv_config(r);
RequestContextPtr request_context(
cfg_s->server_context->NewRequestContext(r));
NgxPagespeedConsoleAsyncFetch fetch(request_context, &writer);
server_context->ConsoleHandler(*server_context->config(),
SystemServerContext::kStatistics,
query_params,
&fetch);
fetch.FlushToNgx(output, r);
return NGX_OK;
}
case RequestRouting::kMessages: {
GoogleString log;
StringWriter log_writer(&log);
@@ -2643,12 +2652,16 @@ ngx_int_t ps_content_handler(ngx_http_request_t* r) {
case RequestRouting::kBeacon:
return ps_beacon_handler(r);
case RequestRouting::kStaticContent:
case RequestRouting::kStatistics:
case RequestRouting::kConsole:
case RequestRouting::kMessages:
return ps_simple_handler(r, cfg_s->server_context, response_category);
case RequestRouting::kStatistics:
case RequestRouting::kGlobalStatistics:
case RequestRouting::kConsole:
case RequestRouting::kAdmin:
case RequestRouting::kGlobalAdmin:
case RequestRouting::kResource:
return ps_resource_handler(r, false /* html rewrite */);
return ps_resource_handler(
r, false /* html rewrite */, response_category);
}
CHECK(0);
+27 -1
View File
@@ -37,6 +37,13 @@ namespace net_instaweb {
namespace {
const char kStatisticsPath[] = "StatisticsPath";
const char kGlobalStatisticsPath[] = "GlobalStatisticsPath";
const char kConsolePath[] = "ConsolePath";
const char kMessagesPath[] = "MessagesPath";
const char kAdminPath[] = "AdminPath";
const char kGlobalAdminPath[] = "GlobalAdminPath";
// These options are copied from mod_instaweb.cc, where APACHE_CONFIG_OPTIONX
// indicates that they can not be set at the directory/location level. They set
// options in the RewriteDriverFactory, so they do not appear in RewriteOptions.
@@ -92,7 +99,26 @@ void NgxRewriteOptions::Init() {
}
void NgxRewriteOptions::AddProperties() {
// Nothing ngx-specific for now.
// Nginx-specific options.
add_ngx_option(
"", &NgxRewriteOptions::statistics_path_, "nsp", kStatisticsPath,
kProcessScope, "Set the statistics path. Ex: /ngx_pagespeed_statistics");
add_ngx_option(
"", &NgxRewriteOptions::global_statistics_path_, "ngsp",
kGlobalStatisticsPath, kProcessScope,
"Set the global statistics path. Ex: /ngx_pagespeed_global_statistics");
add_ngx_option(
"", &NgxRewriteOptions::console_path_, "ncp", kConsolePath, kProcessScope,
"Set the console path. Ex: /pagespeed_console");
add_ngx_option(
"", &NgxRewriteOptions::messages_path_, "nmp", kMessagesPath,
kProcessScope, "Set the messages path. Ex: /ngx_pagespeed_message");
add_ngx_option(
"", &NgxRewriteOptions::admin_path_, "nap", kAdminPath,
kProcessScope, "Set the admin path. Ex: /pagespeed_admin");
add_ngx_option(
"", &NgxRewriteOptions::global_admin_path_, "ngap", kGlobalAdminPath,
kProcessScope, "Set the global admin path. Ex: /pagespeed_global_admin");
MergeSubclassProperties(ngx_properties_);
+30 -2
View File
@@ -68,6 +68,24 @@ class NgxRewriteOptions : public SystemRewriteOptions {
static const NgxRewriteOptions* DynamicCast(const RewriteOptions* instance);
static NgxRewriteOptions* DynamicCast(RewriteOptions* instance);
const GoogleString& statistics_path() const {
return statistics_path_.value();
}
const GoogleString& global_statistics_path() const {
return global_statistics_path_.value();
}
const GoogleString& console_path() const {
return console_path_.value();
}
const GoogleString& messages_path() const {
return messages_path_.value();
}
const GoogleString& admin_path() const {
return admin_path_.value();
}
const GoogleString& global_admin_path() const {
return global_admin_path_.value();
}
private:
// Helper methods for ParseAndSetOptions(). Each can:
@@ -109,10 +127,20 @@ class NgxRewriteOptions : public SystemRewriteOptions {
static void add_ngx_option(typename OptionClass::ValueType default_value,
OptionClass NgxRewriteOptions::*offset,
const char* id,
StringPiece option_name) {
AddProperty(default_value, offset, id, option_name, ngx_properties_);
StringPiece option_name,
OptionScope scope,
const char* help) {
AddProperty(default_value, offset, id, option_name, scope, help,
ngx_properties_);
}
Option<GoogleString> statistics_path_;
Option<GoogleString> global_statistics_path_;
Option<GoogleString> console_path_;
Option<GoogleString> messages_path_;
Option<GoogleString> admin_path_;
Option<GoogleString> global_admin_path_;
// Helper for ParseAndSetOptions. Returns whether the two directives equal,
// ignoring case.
bool IsDirective(StringPiece config_directive, StringPiece compare_directive);
+38 -39
View File
@@ -1123,44 +1123,43 @@ http_proxy=$SECONDARY_HOSTNAME fetch_until $PROXIED_IMAGE \
WGET_ARGS=""
# TODO(jud): Enable this test when support for the admin page has been added.
# start_test ShowCache without URL gets a form, inputs, preloaded UA.
# ADMIN_CACHE=$PRIMARY_SERVER/pagespeed_admin/cache
# OUT=$($WGET_DUMP $ADMIN_CACHE)
# check_from "$OUT" fgrep -q "<form "
# check_from "$OUT" fgrep -q "<input "
# check_from "$OUT" fgrep -q "Cache-Control: max-age=0, no-cache"
# # Preloaded user_agent value field leading with "Mozilla" set in
# # ../automatic/system_test_helpers.sh to help test a "normal" flow.
# check_from "$OUT" fgrep -q 'name=user_agent value="Mozilla'
#
# start_test ShowCache with bogus URL gives a 404
# wget $PRIMARY_SERVER/pagespeed_cache?url=bogus_format >& /dev/null
# check [ $? = 8 ]
#
# start_test ShowCache with valid, present URL, with unique options.
# options="PageSpeedImageInlineMaxBytes=6765"
# fetch_until -save $EXAMPLE_ROOT/rewrite_images.html?$options \
# 'grep -c Puzzle\.jpg\.pagespeed\.ic\.' 1
# URL_TAIL=$(grep Puzzle $FETCH_UNTIL_OUTFILE | cut -d \" -f 2)
# SHOW_CACHE_URL=$EXAMPLE_ROOT/$URL_TAIL
# SHOW_CACHE_QUERY=$ADMIN_CACHE?url=$SHOW_CACHE_URL\&$options
# OUT=$($WGET_DUMP $SHOW_CACHE_QUERY)
# check_from "$OUT" fgrep -q cache_ok:true
# check_from "$OUT" fgrep -q mod_pagespeed_example/images/Puzzle.jpg
#
# function show_cache_after_flush() {
# start_test ShowCache with same URL and matching options misses after flush
# OUT=$($WGET_DUMP $SHOW_CACHE_QUERY)
# check_from "$OUT" fgrep -q cache_ok:false
# }
#
# on_cache_flush show_cache_after_flush
#
# start_test ShowCache with same URL but new options misses.
# options="PageSpeedImageInlineMaxBytes=6766"
# OUT=$($WGET_DUMP $ADMIN_CACHE?url=$SHOW_CACHE_URL\&$options)
# check_from "$OUT" fgrep -q cache_ok:false
start_test ShowCache without URL gets a form, inputs, preloaded UA.
ADMIN_CACHE=$PRIMARY_SERVER/pagespeed_admin/cache
OUT=$($WGET_DUMP $ADMIN_CACHE)
check_from "$OUT" fgrep -q "<form "
check_from "$OUT" fgrep -q "<input "
check_from "$OUT" fgrep -q "Cache-Control: max-age=0, no-cache"
# Preloaded user_agent value field leading with "Mozilla" set in
# ../automatic/system_test_helpers.sh to help test a "normal" flow.
check_from "$OUT" fgrep -q 'name=user_agent value="Mozilla'
start_test ShowCache with bogus URL gives a 404
wget $PRIMARY_SERVER/pagespeed_cache?url=bogus_format >& /dev/null
check [ $? = 8 ]
start_test ShowCache with valid, present URL, with unique options.
options="PageSpeedImageInlineMaxBytes=6765"
fetch_until -save $EXAMPLE_ROOT/rewrite_images.html?$options \
'grep -c Puzzle\.jpg\.pagespeed\.ic\.' 1
URL_TAIL=$(grep Puzzle $FETCH_UNTIL_OUTFILE | cut -d \" -f 2)
SHOW_CACHE_URL=$EXAMPLE_ROOT/$URL_TAIL
SHOW_CACHE_QUERY=$ADMIN_CACHE?url=$SHOW_CACHE_URL\&$options
OUT=$($WGET_DUMP $SHOW_CACHE_QUERY)
check_from "$OUT" fgrep -q cache_ok:true
check_from "$OUT" fgrep -q mod_pagespeed_example/images/Puzzle.jpg
function show_cache_after_flush() {
start_test ShowCache with same URL and matching options misses after flush
OUT=$($WGET_DUMP $SHOW_CACHE_QUERY)
check_from "$OUT" fgrep -q cache_ok:false
}
on_cache_flush show_cache_after_flush
start_test ShowCache with same URL but new options misses.
options="PageSpeedImageInlineMaxBytes=6766"
OUT=$($WGET_DUMP $ADMIN_CACHE?url=$SHOW_CACHE_URL\&$options)
check_from "$OUT" fgrep -q cache_ok:false
# This is dependent upon having a /ngx_pagespeed_beacon handler.
test_filter add_instrumentation beacons load.
@@ -2368,7 +2367,7 @@ start_test IPRO flow uses cache as expected.
STATS=$OUTDIR/blocking_rewrite_stats
IPRO_ROOT=http://ipro.example.com/mod_pagespeed_test/ipro
URL=$IPRO_ROOT/test_image_dont_reuse2.png
IPRO_STATS_URL=http://ipro.example.com/ngx_pagespeed_statistics?PageSpeed=off
IPRO_STATS_URL=http://ipro.example.com/ngx_pagespeed_statistics
# Initial stats.
http_proxy=$SECONDARY_HOSTNAME $WGET_DUMP $IPRO_STATS_URL > $STATS.0
+51
View File
@@ -27,6 +27,13 @@ http {
proxy_cache_path "@@PROXY_CACHE@@" levels=1:2 keys_zone=htmlcache:60m inactive=90m max_size=50m;
proxy_temp_path "@@TMP_PROXY_CACHE@@";
pagespeed StatisticsPath /ngx_pagespeed_statistics;
pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics;
pagespeed ConsolePath /pagespeed_console;
pagespeed MessagesPath /ngx_pagespeed_message;
pagespeed AdminPath /pagespeed_admin;
pagespeed GlobalAdminPath /pagespeed_global_admin;
root "@@SERVER_ROOT@@";
# Block 5a: Decide on Cache-Control header value to use for outgoing
@@ -234,6 +241,45 @@ http {
}
}
server {
listen @@SECONDARY_PORT@@;
server_name if-in-server.example.com;
pagespeed FileCachePath "@@SECONDARY_CACHE@@";
pagespeed RewriteLevel PassThrough;
set $inline_javascript "No";
if ($http_x_custom_header_inline_js) {
# TODO(jefftk): Turn on NGX_HTTP_SIF_CONF and figure out how to get
# pagespeed directives inside of a server location block to be respected,
# then uncomment the following line and duplicate the if-in-location test
# for if-in-server.
#pagespeed EnableFilters inline_javascript;
set $inline_javascript "Yes";
}
add_header "X-Inline-Javascript" $inline_javascript;
}
server {
listen @@SECONDARY_PORT@@;
server_name if-in-location.example.com;
pagespeed FileCachePath "@@SECONDARY_CACHE@@";
location / {
set $inline_javascript "No";
pagespeed RewriteLevel PassThrough;
if ($http_x_custom_header_inline_js) {
pagespeed EnableFilters inline_javascript;
set $inline_javascript "Yes";
}
add_header "X-Inline-Javascript" $inline_javascript;
}
}
server {
listen @@SECONDARY_PORT@@;
server_name mpd.example.com;
@@ -872,6 +918,11 @@ http {
server_name localhost;
pagespeed FileCachePath "@@FILE_CACHE@@";
location ~ ^/pagespeed_admin {
allow 127.0.0.1;
deny all;
}
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}