-
Notifications
You must be signed in to change notification settings - Fork 155
Strip subresource hints #973
Comments
This is tricky. Imagine you have a page:
Then PageSpeed changes Unfortunately we may not be able to correctly rewrite the subresource tag, because what url we use depends on context. For example, we might have resized an image, or combined some resources. To fix this we need to:
We should do the first part now, because we're making things worse. The second one is substantial work, and is more of a new feature, but would still be good. I'm opening #1158 for the feature, and keeping this for the bug. |
I'll take a look at stripping out any existing subresource tags/headers |
I think we should use the pcache for this. If we strip all subresources
|
@jmarantz Yes, I agree we should use the property cache, and I've filed #1158 for that. If people are mostly using subresource tags to reference things loaded by js then we should leave existing ones in for now, while if they're mostly referencing things loaded declaratively then we should remove them. I'll try to find out. |
IMO there is not a strong reason to use subresource hints for resources On Mon, Oct 26, 2015 at 9:34 AM, Jeff Kaufman [email protected]
|
I just ran a search for examples of pages with rel=subresource. I found subresource links for resources that were loaded:
(When multiple pages were generated from one template I only counted that once.) First, a bunch of these (7) are just making the page worse and it would be great to strip them out:
Of the remaining 39, PageSpeed currently would rename the referenced resource (making the rel=subresource harmful) 21 times and leave it alone the other 18. So there are cases where there are useful hints that we would strip, but stripping is better than not stripping right now. |
If PreserveUrls is on we shouldn't strip, though. |
Do we have consensus that we should:
? |
@jeffkaufman That makes sense to me |
Is it right to assume that we remove the link rel=subresource unless all preserve url settings(css/javascript/img) are on? For the sake of performance: if we don't do lookups for the type of the resource in the link we will not know beforehand which type a subresource has, so we have to delete the link. |
Yes. Also I think we should retain these links when their URLs are On Wed, Dec 2, 2015 at 8:41 AM, keesspoelstra [email protected]
|
Agreed on both: keep them if PreserveUrls is fully on or they're excluded. |
Do we want a settings to enable/disable this , and should this be default on? |
Can we have a setting to turn this off, but default it to on? If someone is using subresource hints to refer only to resources loaded from js or other ways pagespeed won't be able to find them, then they need a way to opt out of this behavior. But that's very few people per the survey I did above. |
Ok, maybe an idea to make the first pull without the setting, and a later second pull with. |
We should have something in |
What about side effects/behavior with RewriteLevel PassThrough? |
That's tricky. People expect that just setting things to PassThrough means we'll do nothing, but the current pull request doesn't do that. I guess we could say "PassThrough means we don't strip hints, but then if you enable any other filters on top of that we do strip the hints"? But that seems like a big hack. Ideally we would only enable this if you turned on ant filters that might change urls resources, but I don't think we don't currently have a list of those and maintaining one would be annoying. Anyone have thoughts? Right now I'm inclined to go with "yes, this means we'll make changes with PassThrough on" which is sad. |
@jeffkaufman Perhaps we could add a pure virtual method to
Alternatively, a bitmask could be returned indicating which effects/prerequisites a filter has to allow more fine grained control in the pipeline (type of urls changed/html element change). Going through all the filters to implement the new method could be some work, but if we do it like that, would maintenance still be annoying? To lower the amount of work we'd have to do initially for this, we could opt to not go for a pure virtual and return the "worst case" as a default. |
I like this plan. I think it's OK to give it a default implementation of Note that a filter like rewrite_css doesn't change URLs if -Josh On Wed, Dec 9, 2015 at 4:04 PM, Otto van der Schaaf <
|
You'd probably need to return the full bit_mask or true for the default case, because we need to account for worst case. |
You're probably right -- defaulting to all 1s is safer. However it's too Then we can have -Josh On Thu, Dec 10, 2015 at 9:45 AM, keesspoelstra [email protected]
|
I like this. |
Corresponding changes for: - pull apache/incubator-pagespeed-mod#1204 - issue Strip subresource hints #973 apache/incubator-pagespeed-mod#973
@jeffkaufman @jmarantz What would be a good place in the rewrite driver to calculate the combined CanModifyUrls? Will it be ok to mirror DetermineEnabledFilters, and implement it in HtmlParse and RewriteDriver or do we want to use the AddFilter / EnableRewriteFilter / PrependRewriteFilter / AppendRewriteFilter / AddUnownedPostRenderFilter / etc..... functions to calculate the CanModifyUrls? |
Btw....Looking in this area of the code at the representation and api ... Josh
|
Corresponding changes for: - pull apache/incubator-pagespeed-mod#1204 - issue Strip subresource hints #973 apache/incubator-pagespeed-mod#973
Corresponding changes for: - pull apache/incubator-pagespeed-mod#1204 - issue Strip subresource hints #973 apache/incubator-pagespeed-mod#973
Corresponding changes for: - pull apache/incubator-pagespeed-mod#1204 - issue Strip subresource hints #973 apache/incubator-pagespeed-mod#973
Corresponding changes for: - pull apache/incubator-pagespeed-mod#1204 - issue Strip subresource hints #973 apache/incubator-pagespeed-mod#973
Default behaviour is to strip subresource links which are in scope for pagespeed, these are the resources that are not disallowed or are valid domains in the domain laywer. Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which indicates whether urls can be rewritten by the parser and thus should be removed. This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the strip subresource hints feature right now. This should be moved to the HtmlParse tests. DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also determines can_modify_url for all the filters and possible future "behaviors". Added new option to explicitly prevent the default behaviour: ModPreserveSubresourceHints on/off For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root has been added. Fixes Issue #973. (Squash of 54983f4 and b651c78.)
Squashed as c6f0691 for backporting to 1.11.33.0. |
Default behaviour is to strip subresource links which are in scope for pagespeed, these are the resources that are not disallowed or are valid domains in the domain laywer. Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which indicates whether urls can be rewritten by the parser and thus should be removed. This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the strip subresource hints feature right now. This should be moved to the HtmlParse tests. DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also determines can_modify_url for all the filters and possible future "behaviors". Added new option to explicitly prevent the default behaviour: ModPreserveSubresourceHints on/off For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root has been added. Fixes Issue #973. (Squash of 54983f4 and b651c78.)
Default behaviour is to strip subresource links which are in scope for pagespeed, these are the resources that are not disallowed or are valid domains in the domain laywer. Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which indicates whether urls can be rewritten by the parser and thus should be removed. This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the strip subresource hints feature right now. This should be moved to the HtmlParse tests. DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also determines can_modify_url for all the filters and possible future "behaviors". Added new option to explicitly prevent the default behaviour: ModPreserveSubresourceHints on/off For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root has been added. Fixes Issue #973. (Squash of 54983f4 and b651c78.)
Default behaviour is to strip subresource links which are in scope for pagespeed, these are the resources that are not disallowed or are valid domains in the domain laywer. Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which indicates whether urls can be rewritten by the parser and thus should be removed. This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the strip subresource hints feature right now. This should be moved to the HtmlParse tests. DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also determines can_modify_url for all the filters and possible future "behaviors". Added new option to explicitly prevent the default behaviour: ModPreserveSubresourceHints on/off For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root has been added. Fixes Issue #973. (Squash of 54983f4 and b651c78.)
Default behaviour is to strip subresource links which are in scope for pagespeed, these are the resources that are not disallowed or are valid domains in the domain laywer. Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which indicates whether urls can be rewritten by the parser and thus should be removed. This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the strip subresource hints feature right now. This should be moved to the HtmlParse tests. DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also determines can_modify_url for all the filters and possible future "behaviors". Added new option to explicitly prevent the default behaviour: ModPreserveSubresourceHints on/off For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root has been added. Fixes Issue #973. (Squash of 54983f4 and b651c78.)
Default behaviour is to strip subresource links which are in scope for pagespeed, these are the resources that are not disallowed or are valid domains in the domain laywer. Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which indicates whether urls can be rewritten by the parser and thus should be removed. This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the strip subresource hints feature right now. This should be moved to the HtmlParse tests. DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also determines can_modify_url for all the filters and possible future "behaviors". Added new option to explicitly prevent the default behaviour: ModPreserveSubresourceHints on/off For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root has been added. Fixes Issue #973. (Squash of 54983f4 and b651c78.)
Default behaviour is to strip subresource links which are in scope for pagespeed, these are the resources that are not disallowed or are valid domains in the domain laywer. Added can_modify_url flag to HtmlParse and CanModifyUrl function to the HtmlFilter which indicates whether urls can be rewritten by the parser and thus should be removed. This is tested now in the strip_subresource_hints_filter_test.cc as this is only used by the strip subresource hints feature right now. This should be moved to the HtmlParse tests. DetermineEnabledFilters has been rolled up into DetermineFiltersBehaviour, which also determines can_modify_url for all the filters and possible future "behaviors". Added new option to explicitly prevent the default behaviour: ModPreserveSubresourceHints on/off For ubuntu a check for the new setup /var/www/html instead of /var/www for the document root has been added. Fixes Issue #973. (Squash of 54983f4 and b651c78.)
Corresponding changes for: - pull apache/incubator-pagespeed-mod#1204 - issue Strip subresource hints #973 apache/incubator-pagespeed-mod#973
Corresponding changes for: - pull apache/incubator-pagespeed-mod#1204 - issue Strip subresource hints #973 apache/incubator-pagespeed-mod#973
Released in 1.11.33.0. |
Original issue reported on code.google.com by
[email protected]
on 18 Aug 2014 at 6:58The text was updated successfully, but these errors were encountered: