Monday 31 August 2015

Chasing ghostly Hemiptera

This morning I spent quite a while trying to debug why W3TC caching wasn't working for me. In the end it turned out that Chrome was sending PHP Session ID and wordpress cookies, presumably from some old session. But why hadn't they expired?

Well, I didn't look into that, but what I was trying to find out was why my site was hit by a request including OPCONFIG_WS_URL_US when including an Amazon carousel widget in the page. (The full URL being requested was /page-widget-displayed-on/OPCONFIG_WS_URL_US/widgets/q?MarketPlace=US&Operation=GetDisplayTemplate&ServiceVersion=20070822&WS=1&ID=Carousel&panda=1).

I traced this back to the swfobject.js file being included from Amazon to show the widget. In Firefox the URL http://wms.assoc-amazon.com/20070822/US/js/swfobject_1_5.js gave a js file that contained (as well as various other code):

var de_ws_url = "OPCONFIG_WS_URL_DE";
var us_ws_url = "OPCONFIG_WS_URL_US";
var fr_ws_url = "OPCONFIG_WS_URL_FR";
var ca_ws_url = "OPCONFIG_WS_URL_CA";
var cn_ws_url = "OPCONFIG_WS_URL_CN";
var gb_ws_url = "OPCONFIG_WS_URL_GB";
var jp_ws_url = "OPCONFIG_WS_URL_JP";

But the exact same URL in Chrome gave a js file that contained:

var de_ws_url = "//ws-eu.amazon-adsystem.com";
var us_ws_url = "//ws-na.amazon-adsystem.com";
var fr_ws_url = "//ws-eu.amazon-adsystem.com";
var ca_ws_url = "//ws-na.amazon-adsystem.com";
var cn_ws_url = "//ws-cn.amazon-adsystem.com";
var gb_ws_url = "//ws-eu.amazon-adsystem.com";
var jp_ws_url = "//ws-fe.amazon-adsystem.com";

I wondered if Amazon was doing something weird like checking the UA string to see if the browser supported flash, and serving up a broken swfobject file to those that didn't support flash. But after clearing cache in FF, the file was the same as Chrome received, and so the problem was solved.

I can only guess that Amazon had some temporary problems, and FF cached the problem file, but by the time I tried it with Chrome the problem had been fixed.

No comments: