Hello!
I see in my cached folder many copies of the pages. For example:
page.html and page_fb_xd_fragment=.html
Sometimes the pages are with & sign, for example: page_page=0,2&fb_xd_fragment=.html - this is the page 2 of the page (with pager)
Also I have this kind of cached pages: blog_page=154&fb_canvas_destination=node.html
This doubles the number of my cached pages, because they are cached once as page.html, second time as page_fb_xd_fragment=.html, and so on...
This behaviour is result of the button Facebook Like.
I found one discussion about the problem here http://forum.developers.facebook.net/viewtopic.php?pid=235124
It seems, that many people have that problem with Facebook social tools.
When I remove my FB Like buttons, my cached pages are fine. But I need that buttons, they are useful for me.
Can we make some filtering?
I use nginx rewrites, so if there is modify of htaccess, pls, advice me and for nginx.
Thanks in advance! Boost is awesome module!
Comments
Comment #1
Terko commentedI noticed that I have and one additional variant of the cached pages:
page_fbc_channel=1.html
Comment #2
mikeytown2 commentedDo you want to ignore certain key value pairs inside the query string of the URL? In short I see the issue; but how would you like to solve this? Keep in mind that if the file doesn't exist, then that would be a cache miss most likely.
Comment #3
Terko commentedIt seems, that Facebook redirect to my site with address:
example.com/myarticle&fb_xd_fragment
So the cached page is stored once as myarticle_.html when visited normally and when visited from FB - myarticle_fb_xd_fragment_html. So 2 copies of the page are stored.
In fact we know how FB redirects to pages- the arguments that FB uses. The arguments that FB passes are in my first post. So maybe it's possible to filter them.
So, if I visit my site with any argument that I add to the end of the URL, will reflect in generation of cached page. example.com/myarticle&blabla will make new version - myarticle_blabla=.html
If we imagine, this can be successful scenario for attack. It's enough somebody to write script with random generator that produce different arguments to the url and to visit all of them one by one. So the attacked site will be overloaded with many cache versions (CPU cycles - generate, store cached page).
This attack will never use the already cached pages, but will produce CPU load.
I don't know how to solve this.. filter can break other functionality maybe, like custom pagers and so on. I will think for idea.
Comment #4
mikeytown2 commentedI remember talking on IRC about caching and how Drupal is wide open to a DOS via random query strings; good/bad thing is wordpress/joomla and just about any other CMS that uses a page cache is also open to this.
Best solution for this facebook issue in this case would be to strip the
fb_xd_fragmentfrom the query string at the apache level. This would prevent Drupal from ever receiving the facebook key=value pair. Good solution unless you like to do something with the extra junk from facebook.Can you let facebook know that I can not access that link; I can not even use the login page... lovely.
Is there any talk in that link about rewrite rules?
Comment #5
Terko commentedHmm, they banned me from advertising there "For Lifetime", because they said "you used the advertising for spam", something like this. I wroted to them that I never used their advertising solutions, never entered my CC there to use it, so it's very strange, why I am banned "for lifetime". And they lifted the ban. I will try to write to them.
I will quote 2 messages from there:
And one possible solution, that I am not sure that it can help:
Comment #6
mikeytown2 commentedRecommend filtering the query string. Asked a "how to"... lets see if anyone can figure this out; I don't have the time ATM
http://stackoverflow.com/questions/3706624/remove-query-string-keyvalue-...
Related
http://stackoverflow.com/questions/2955012/facebook-javascript-sdk-fb-xd...
Comment #7
Terko commentedBy the way, I noticed that If the user click on the message from the wall published yesterday, in boost cache we have generated new version called page_yesterday
But it's strange, because i have and such pages _page=34&part=yesterday.html- and i think that nobody published link to page=34 (there are many files like this, not only one.) And again new version _page=40&part=week.html
Another strange thing is _page=79&action=login.html - again, this is not article page, but pager page.
And last thing - _page=122&iframe=true&width=900&height=450.html
I start to think that maybe not only FB Like is involved here. I will try to see what Application settings I have in Facebook. Before month or two I had FB Connect module activated, but I uninstalled it. Maybe this is something caused from the PHP Library that comes with the module...
First I will disable FB Like for 1 day to see if this will stop generating of such cache pages. Maybe this can help me to trace the origin.
Comment #8
Terko commentedI think, that I found solution!
You need to put in your page.tpl right before the closing tag this code:
I've implemented this and almost half a hour I don't have such cached pages. The server load was reduced!
It seems, that this is old bug in Facebook Like.
You can read more for this bug here:
http://forum.developers.facebook.net/viewtopic.php?pid=232516
And here:
http://bugs.developers.facebook.net/show_bug.cgi?id=9777
So, maybe Boost users with FB Like buttons is good to implement this workaround. I will report later if this workaround continues to work fine (i hope!)
Comment #9
stephane.bottine commentedHey guys, check this blog post. It explains where the problem is coming from and suggests ways to fix it: http://www.searchmarketingman.com/2010/09/how-to-fix-like-button-bug.html
Comment #10
Terko commentedStephane, this is great info, it shows that this is problem to many others...
But in Boost there is problem, because it creates pages and pages in the cache.
My fix didn't help. My boost directory is again full with pages. My website have 3000 nodes and for one or two days in cache directory I collect more than 9000 cached pages. The correct pages are no more than 2 or 3000. All other cached pages are caused from this Facebook behaviour.
All other pages, caused from the Facebook URL arguments are useless pages. They make my PHP to produce more and more cached pages and additionally loads my CPU.
I am very surprised, that I am the only one, that reports this and few other guys suffer from this behavior...
Comment #11
mattwmc commentedIts not just users of Boost or Drupal who are experiencing the bug.
http://forum.developers.facebook.net/viewtopic.php?pid=234022
Comment #12
Ela commentedsubscribing
Comment #13
Chad_Dupuis commentedsub
Comment #14
mattwmc commentedHere is a supposed fix:
Custom Channel URL: http://hustoknow.blogspot.com/2011/02/facebooks-cross-domain-xd-receiver...
I'm not a developer how would I do this:
"You MUST send valid Expires headers and ensure the channel
file is cached by the browser. We recommend caching indefinitely. "
Comment #15
burningdog commentedIt depends on how you're embedding your Facebook Like buttons, but if you're using the Facebook Javascript SDK (or the fb_social module to do it for you) then take a look at this patch: http://drupal.org/node/1177776#comment-4554326
It adds the fix at #14 as well as adding them magic headers :)