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 |
Sign in to add a comment
|
From: thibaultdelor [email protected] 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 [email protected],
Feb 9, 2012
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
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.
May 14, 2012
,
(No comment was entered for this change.)
Status: WontFix
May 29, 2012
,
(No comment was entered for this change.)
Status: Duplicate
Mergedinto: 393
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.
|