牛骨文教育服务平台(让学习变的简单)
博文笔记

ModPagespeedDisableFilters trim_urls

创建时间:2012-07-28 投稿人: 浏览次数:735

I

 

 

 

 

 

 

ssue 379:

trim_urls breaks relative reference in 0.10.19.5 ‹ Prev 0 of 127
  2 people starred this issue and may be notified of changes. Back to list
Status: Duplicate
Merged: issue 393
Owner: jmaes...@google.com
Closed: May 14
Cc: delor.th...@gmail.com
Type-Defect Priority-Medium


Sign in to add a comment
Reported by project member jmara...@google.com, Feb 9, 2012
From: thibaultdelor delor.thibault@gmail.com
9:17 PM (12 hours ago)

to mod-pagespeed-. 
Hey,
I have an issue with trim_urls which I could not solve.
I have page (/pages/node1) that dynamically load another content (/
content1). In /content1 I have an image (/img/bg.png). When getting in
ajax /content1, my image src attribute is changed to "img/
bg.pnd.pagespeedXXXX". The filter trim_urls is removing the / at the
begginning, and so when injecting into my main page, the image can"t
be found (since it looks for /pages/mg/bg.pnd.pagespeedXXXX)

I am surprised that a google search don"t return any similar case.
Have you a solution for that.
Is it possible to remove the filter trim_urls only for specifics pages
(for example a parameter in the url?). If I turn off completely the
trim_urls filter it works but all my resources are prefixed with my
site url (e.g http://www.mysite.com/img/bg.pnd.pagespeedXXXX) even
when adding a base tag...

Can I just said to pagespeed something like "add your suffix for
optimizing resources but don"t touch my prefix, i know what I am
doing" :D

Cheers,
Regards

Tibo
Comment 1 by project member sligocki@google.com, Feb 9, 2012
delor.thibault, do you have a URL that demonstrates this problem? Thanks.
Comment 2 by delor.th...@gmail.com, Feb 9, 2012
The website is on pre-production server which is not public. But I have made a gist for you to illustrate my problem and show the bad result.
http://gist.github.com/1785003

Thanks


Comment 3 by project member jmara...@google.com, May 10, 2012
(No comment was entered for this change.)
Owner: jmaes...@google.com
Comment 4 by project member jmaes...@google.com, May 14, 2012
Confirmed.  The problem is indeed that trim_urls is absolutifying based on the position of the included html, rather than the ultimate position of the page into which it is inserted.  For example, myPartialContent.html had instead contained a relative path like "../js/myjs.js" the file would not be fetched at all and things would likely be *really* messed up.  Fundamentally, mod_pagespeed can"t tell when you fetch myPartialContent.html that it will ultimately be injected into /pages/myMainContent.html, and ends up treating it like any other standalone page.

Your best expedient is to use .htaccess or an apache Directory section in your .conf files to enable trim_urls in /pages but leave it disabled in the root of your site:

Global config:
ModPagespeedDisableFilters trim_urls

.htaccess in /pages/:
ModPagespeedEnableFilters trim_urls

  More generally, disable trim_urls in directories that contain html that is being injected into a page residing at a different path.
Comment 5 by project member jmaes...@google.com, May 14, 2012
(No comment was entered for this change.)
Status: WontFix
Comment 6 by project member jmara...@google.com, May 29, 2012
(No comment was entered for this change.)
Status: Duplicate
Mergedinto: 393
Comment 7 by project member jmara...@google.com, May 29, 2012
Sorry about the confusion.  We gave in and decided to remove trim_urls from the core set due to this issue, which is the same as #393.  We already fixed this in trunk and it"s in source release 0.10.22.3.  We will cut a new binary release soon.

 
 
 
hello, 在 conf.dpagespeed.conf 第56行后面加一行 ,然后重启试试 ModPagespeedDisableFilters trim_urls

声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。