The problem is base tag (<base>) is at the end of the head section. so the links ahead of base tag is ignored. With a thought, turning on the option of preserving url relativity so that domain rewrite should not depend base tag. so here is a fix:
diff --git a/mod_pagespeed/src-11-21/net/instaweb/rewriter/domain_rewrite_filter.cc b/mod_pagespeed/src-11-21/net/instaweb/re
index be54c87..f1ec3aa 100644
--- a/mod_pagespeed/src-11-21/net/instaweb/rewriter/domain_rewrite_filter.cc
+++ b/mod_pagespeed/src-11-21/net/instaweb/rewriter/domain_rewrite_filter.cc
@@ -394,9 +394,10 @@ void DomainRewriteFilter::ParseSetCookieAttributes(
}
void DomainRewriteFilter::StartElementImpl(HtmlElement* element) {
+ const RewriteOptions* options = driver()->options();
// The base URL is used to rewrite the attribute URL, which is all this
// method does; if it isn't valid we can't so there's no point in going on.
- if (!BaseUrlIsValid()) {
+ if (!options->preserve_url_relativity() && !BaseUrlIsValid()) {
// The base URL is used to rewrite the attribute URL, which is all this
// method does; if it isn't valid we can't so there's no point in going on.
//
@@ -408,7 +409,6 @@ void DomainRewriteFilter::StartElementImpl(HtmlElement* element) {
// Make sure domain rewriting of this element has not been forbidden. Right
// now we must not rewrite the src url of the iframe created by the
// iframe_fetcher.
- const RewriteOptions* options = driver()->options();
if (options->mob_iframe() &&
(StringPiece(element->EscapedAttributeValue(HtmlName::kId)) ==
IframeFetcher::kIframeId) &&
Alex