Pagespeed is stuffing up Magento 2 knockout.js table headers

612 views
Skip to first unread message

Dallas Clarke

unread,
May 21, 2016, 2:33:21 AM5/21/16
to mod-pagespeed-discuss
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

Joshua Marantz

unread,
May 21, 2016, 12:15:56 PM5/21/16
to mod-pagespeed-discuss

Can you supply any more detail?   Is this on the admin panel?  Or also customer facing?   What version of pagespeed?  What are your config settings?

Is there anything in the browser dev tools console when the failure occurs?

Is there anything in that Apache log when the failure occurs?

My guess is that this is a simple matter of blacklisting a single file this magneto does not expect to be renamed.

Josh

On May 21, 2016 2:33 AM, "Dallas Clarke" <ekky.s...@gmail.com> wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/b2da7181-9fc2-4fcf-8978-d414fb3d606d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carl Whalley

unread,
Apr 24, 2017, 5:13:57 AM4/24/17
to mod-pagespeed-discuss
I can confirm this, and other issues with Magento 2 - 3 in total, one I can fix.

Pagespeed 1.12.34.1-0
Memcached 1.4.25-2ubuntu1.2
Magento 2.1.6
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2016-07-14T12:32:26

1. When logged in as admin, the header titles for the various order, invoice etc grid (as the OP described) are squeezed hard left. IOW the CSS is broken. I tried every combination of CSS related mps params and couldn't find the one which fixed it.

2. If you enable remove_comments, the icon on the shopping cart (customer facing) is a solid rectangle. With it disabled, the number of items in the cart is shown. Suspect it uses a font package where comments are significant.

3. The layout of the text in the popup shopping cart is screwed up with mps enabled. It's like 1. above.

I tried with the default mps. 

On a positive side, it does seem to be only minor css issues - the performance is great. Unfortunately though, these mean we have to disable mps until resolved. Magento 2 has an internal caching system.

Testing is straightforward - install default mps, install current default Magento, place orders in cart, observe describe problems in cart, log in as admin, observe described problems in orders list.

-- Carl Whalley

On Saturday, May 21, 2016 at 5:15:56 PM UTC+1, jmarantz wrote:

Can you supply any more detail?   Is this on the admin panel?  Or also customer facing?   What version of pagespeed?  What are your config settings?

Is there anything in the browser dev tools console when the failure occurs?

Is there anything in that Apache log when the failure occurs?

My guess is that this is a simple matter of blacklisting a single file this magneto does not expect to be renamed.

Josh

On May 21, 2016 2:33 AM, "Dallas Clarke" <ekky.s...@gmail.com> wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Carl Whalley

unread,
Apr 30, 2017, 12:46:03 PM4/30/17
to mod-pagespeed-discuss
More info:

It turns out my point 3: has already been raised, and again there is a clue it's knockout.js causing al of these issues:

How can I test your idea of blacklisting knockout.js?

Cheers

-- Carl Whalley

On Saturday, May 21, 2016 at 5:15:56 PM UTC+1, jmarantz wrote:

Can you supply any more detail?   Is this on the admin panel?  Or also customer facing?   What version of pagespeed?  What are your config settings?

Is there anything in the browser dev tools console when the failure occurs?

Is there anything in that Apache log when the failure occurs?

My guess is that this is a simple matter of blacklisting a single file this magneto does not expect to be renamed.

Josh

On May 21, 2016 2:33 AM, "Dallas Clarke" <ekky.s...@gmail.com> wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Joshua Marantz

unread,
Apr 30, 2017, 1:43:28 PM4/30/17
to mod-pagespeed-discuss
Try
  ModPagespeedDisallow */knockout.js



On Apr 30, 2017 12:46 PM, "Carl Whalley" <carl.w...@gmail.com> wrote:
More info:

It turns out my point 3: has already been raised, and again there is a clue it's knockout.js causing al of these issues:

How can I test your idea of blacklisting knockout.js?

Cheers

-- Carl Whalley

On Saturday, May 21, 2016 at 5:15:56 PM UTC+1, jmarantz wrote:

Can you supply any more detail?   Is this on the admin panel?  Or also customer facing?   What version of pagespeed?  What are your config settings?

Is there anything in the browser dev tools console when the failure occurs?

Is there anything in that Apache log when the failure occurs?

My guess is that this is a simple matter of blacklisting a single file this magneto does not expect to be renamed.

Josh

On May 21, 2016 2:33 AM, "Dallas Clarke" <ekky.s...@gmail.com> wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Carl Whalley

unread,
Apr 30, 2017, 4:05:42 PM4/30/17
to mod-pagespeed-discuss
On Sunday, April 30, 2017 at 6:43:28 PM UTC+1, jmarantz wrote:
Try
  ModPagespeedDisallow */knockout.js

Thanks. Unfortunately it made no difference. 


On Apr 30, 2017 12:46 PM, "Carl Whalley" <carl.w...@gmail.com> wrote:
More info:

It turns out my point 3: has already been raised, and again there is a clue it's knockout.js causing al of these issues:

How can I test your idea of blacklisting knockout.js?

Cheers

-- Carl Whalley

On Saturday, May 21, 2016 at 5:15:56 PM UTC+1, jmarantz wrote:

Can you supply any more detail?   Is this on the admin panel?  Or also customer facing?   What version of pagespeed?  What are your config settings?

Is there anything in the browser dev tools console when the failure occurs?

Is there anything in that Apache log when the failure occurs?

My guess is that this is a simple matter of blacklisting a single file this magneto does not expect to be renamed.

Josh

On May 21, 2016 2:33 AM, "Dallas Clarke" <ekky.s...@gmail.com> wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/b2da7181-9fc2-4fcf-8978-d414fb3d606d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joshua Marantz

unread,
Apr 30, 2017, 6:48:06 PM4/30/17
to mod-pagespeed-discuss
Sorry.... Looked back at the thread:
...if you enable remove_comments, the icon on the shopping cart (customer facing) is a solid rectangle. With it disabled, the number of items in the cart is shown. Suspect it uses a font package where comments are significant.

Can you figure out what the comments look like that you suspect are significant?  Are they comments in HTML?  If so, you can use
   ModPagespeedRetainComment WILDCARD_PATTERN
as a workaround.  See https://modpagespeed.com/doc/filter-comment-remove for details.

On Apr 30, 2017 4:05 PM, "Carl Whalley" <carl.w...@gmail.com> wrote:
On Sunday, April 30, 2017 at 6:43:28 PM UTC+1, jmarantz wrote:
Try
  ModPagespeedDisallow */knockout.js

Thanks. Unfortunately it made no difference. 
On Apr 30, 2017 12:46 PM, "Carl Whalley" <carl.w...@gmail.com> wrote:
More info:

It turns out my point 3: has already been raised, and again there is a clue it's knockout.js causing al of these issues:

How can I test your idea of blacklisting knockout.js?

Cheers

-- Carl Whalley

On Saturday, May 21, 2016 at 5:15:56 PM UTC+1, jmarantz wrote:

Can you supply any more detail?   Is this on the admin panel?  Or also customer facing?   What version of pagespeed?  What are your config settings?

Is there anything in the browser dev tools console when the failure occurs?

Is there anything in that Apache log when the failure occurs?

My guess is that this is a simple matter of blacklisting a single file this magneto does not expect to be renamed.

Josh

On May 21, 2016 2:33 AM, "Dallas Clarke" <ekky.s...@gmail.com> wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsubscri...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/92436bdf-5bf6-475d-9762-3761f7f51f10%40googlegroups.com.

Carl Whalley

unread,
May 1, 2017, 9:02:55 AM5/1/17
to mod-pagespeed-discuss
On Sunday, April 30, 2017 at 11:48:06 PM UTC+1, jmarantz wrote:
Sorry.... Looked back at the thread:
...if you enable remove_comments, the icon on the shopping cart (customer facing) is a solid rectangle. With it disabled, the number of items in the cart is shown. Suspect it uses a font package where comments are significant.

Can you figure out what the comments look like that you suspect are significant?  Are they comments in HTML?  If so, you can use
   ModPagespeedRetainComment WILDCARD_PATTERN
as a workaround.  See https://modpagespeed.com/doc/filter-comment-remove for details.

I found something very confusing and couldn't see what was going wrong in the page source, so made an installation we can play with (Magento 2.1.6 CE, default with sample data). This isn't the cart icon font issue, it's the cart pop up CSS corruption. I think knockout is doing some fancy ajax stuff to behave this way. So, here's how to recreate it and you'll see why it's so confusing:

Use a clean acc (e.g. Chrome Guest mode)
Add anything to cart
Click cart icon
Click the "view and edit cart" link in the cart pop up
Observe CSS corruption in Summary box - the line with "Order total" in
View page source to confirm pagespeed is on
Observe CSS corruption still present
View page source to confirm pagespeed is off

Memcached is being used with apache in case that's relevant.

-- Carl Whalley




On Apr 30, 2017 4:05 PM, "Carl Whalley" <carl.w...@gmail.com> wrote:
On Sunday, April 30, 2017 at 6:43:28 PM UTC+1, jmarantz wrote:
Try
  ModPagespeedDisallow */knockout.js

Thanks. Unfortunately it made no difference. 
On Apr 30, 2017 12:46 PM, "Carl Whalley" <carl.w...@gmail.com> wrote:
More info:

It turns out my point 3: has already been raised, and again there is a clue it's knockout.js causing al of these issues:

How can I test your idea of blacklisting knockout.js?

Cheers

-- Carl Whalley

On Saturday, May 21, 2016 at 5:15:56 PM UTC+1, jmarantz wrote:

Can you supply any more detail?   Is this on the admin panel?  Or also customer facing?   What version of pagespeed?  What are your config settings?

Is there anything in the browser dev tools console when the failure occurs?

Is there anything in that Apache log when the failure occurs?

My guess is that this is a simple matter of blacklisting a single file this magneto does not expect to be renamed.

Josh

On May 21, 2016 2:33 AM, "Dallas Clarke" <ekky.s...@gmail.com> wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Otto van der Schaaf

unread,
May 1, 2017, 2:39:50 PM5/1/17
to mod-pagespeed-discuss
Does adding the following to the configuration fix the order total line?:

ModPagespeedDisallow */pub/static/version1493639851/frontend/Magento/luma/en_GB/Magento_Tax/template/checkout/cart/totals/grand-total.html

The html that gets loaded via ajax is being processed by mod_pagespeed, and in this case a <head/> tag is added.

Otto


To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/0ba70816-d66e-4d9d-8710-0a1a958ea19d%40googlegroups.com.

Carl Whalley

unread,
May 1, 2017, 4:24:34 PM5/1/17
to mod-pagespeed-discuss
I added that this way to .htaccess

<IfModule pagespeed_module>
    ModPagespeed on
    ModPagespeedDisallow */pub/static/version1493639851/frontend/Magento/luma/en_GB/Magento_Tax/template/checkout/cart/totals/grand-total.html
</IfModule>

Thanks. It's made some difference - it looks like the word "Order.." is missing now, but the layout is still borked.

-- Carl Whalley

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Otto van der Schaaf

unread,
May 1, 2017, 4:52:01 PM5/1/17
to mod-pagesp...@googlegroups.com
Looking at the request patterns of the site maybe something like this would work:

ModPagespeedDisallow /Magento_*/frontend/Magento*/templates/*.html

The goal would be to exclude all html that gets loaded via javascript
(the previous suggestion just excluded one file that I figured could be causing issues, you can remove that if you add the above).

Otto

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mod-pagespeed-discuss/1148f5b8-dba7-4fc1-a2b3-461d7a35538a%40googlegroups.com.

Carl Whalley

unread,
May 1, 2017, 9:49:40 PM5/1/17
to mod-pagespeed-discuss
On Monday, May 1, 2017 at 9:52:01 PM UTC+1, Otto van der Schaaf wrote:
Looking at the request patterns of the site maybe something like this would work:

ModPagespeedDisallow /Magento_*/frontend/Magento*/templates/*.html

The goal would be to exclude all html that gets loaded via javascript
(the previous suggestion just excluded one file that I figured could be causing issues, you can remove that if you add the above).

Otto

I added that line, removed the previous one, restarted memcached and apache2 but it made no difference. 
 

To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mod-pagespeed-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mod-pagespeed-discuss+unsub...@googlegroups.com.

Jeremy H

unread,
May 4, 2017, 12:17:56 AM5/4/17
to mod-pagespeed-discuss

On Saturday, May 21, 2016 at 1:33:21 AM UTC-5, Dallas Clarke wrote:
Just reporting the bug that Pagespeed is stuffing up Magento 2 knockout.js table headers on the customer, orders grids etc.

If someone there what's to have a look at the Magento 2 admin section with the ajax loading, otherwise I forced to turn pagespeed off.

knockout.js relies on html comments for it's templating and injection. If you have the remove_comments filter enabled it will break the knockout.js everywhere. the remove_quotes filter has some oddities as well in Magento 2. If you're going off the h-o.nl blog regarding magento pagespeed, be advised that blog was written for M1 and not M2.

Additionally you can use:
ModPagespeedDisallow "http://mysite.com/myadmin/*"

To keep mod_pagespeed from operating on your admin pages.

Don't forget when making any changes to mod_pagespeed to remove it's cache or you may still be seeing weird things. On my box (CentOS) the cache is in /var/cache/mod_pagespeed   I just rm -r the contents of that directory before restarting apache when I make filter or magento template changes.

My safe filters on M2 that so far have not broken anything (combined with disallowing pagespeed on admin urls, I let M2 minify js and css):

       ModPagespeedEnableFilters collapse_whitespace
       ModPagespeedEnableFilters insert_dns_prefetch
       ModPagespeedEnableFilters rewrite_css
       ModPagespeedEnableFilters fallback_rewrite_css_urls
       ModPagespeedEnableFilters prioritize_critical_css

    ModPagespeedDisableFilters inline_css
    ModPagespeedDisableFilters combine_javascript
    ModPagespeedDisableFilters inline_javascript


One thing I have noticed however is the prioritize_critical_css does not seem to be working for me on M2, have not figured out why yet.

Carl Whalley

unread,
May 7, 2017, 5:19:22 AM5/7/17
to mod-pagespeed-discuss
Hi Jeremy,

Thanks ... very interesting. Unfortunately it's not helped though. Perform the same test mentioned earlier at https://magento.otacloud.com to see the same borked CSS in the cart.

I applied the following to .htaccess, and restarted memcached and apache2:

<IfModule pagespeed_module>
    ModPagespeed on

    ModPagespeedRewriteLevel CoreFilters

    ModPagespeedDisallow "http://magento.otacloud.com/admin/*"
    ModPagespeedDisallow "https://magento.otacloud.com/admin/*"

    ModPagespeedEnableFilters collapse_whitespace
    ModPagespeedEnableFilters insert_dns_prefetch
    ModPagespeedEnableFilters rewrite_css
    ModPagespeedEnableFilters fallback_rewrite_css_urls
    ModPagespeedEnableFilters prioritize_critical_css

    ModPagespeedDisableFilters inline_css
    ModPagespeedDisableFilters combine_javascript
    ModPagespeedDisableFilters inline_javascript
    ModPagespeedDisableFilters remove_comments
    ModPagespeedDisableFilters remove_quotes
</IfModule>

-- Carl Whalley

Carl Whalley

unread,
May 8, 2017, 4:40:54 AM5/8/17
to mod-pagespeed-discuss
Just found out about the debug tool to show the config in the source, so I'll leave that option enabled and stop dumping my params.

Reply all
Reply to author
Forward
0 new messages