No CSS in classifieds

Author
Discussion

markp111

Original Poster:

5 posts

109 months

Sunday 26th April 2015
quotequote all
I seem to have a javascript problem, when trying to view the classifieds, that results in no CSS being used. Therefore I get plain unformatted HTML pages which are really long and really hard to navigate. I get this problem in both browsers that I have tried (Firefox and Chrome).

I think that some javascript code is supposed to change this source:
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/2969/Assets/bundles/commonstyles.css" />
to something like this:
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/2969/Assets/bundles/commonstyles.css" />
without that '2969' in the url, when I go to the url of the css file I get:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>Assets/bundles/commonstyles.css</Key><RequestId>D01D435A61E1E4E5</RequestId><HostId>QbcC5DsswoiPLpsTh9WaycoYdG2PqdYH6b513HvV0wx7e58Hy/zI1h02vBFgHkMpqfrIqLYiBZE=</HostId></Error>

So, my guess is that there is a piece of javascript, only used in your classified ads system, that is failing to put the 'key' into the css urls when I visit your classifieds.

I also note that the classifieds widget on your homepage is just showing javascript code - not rendered HTML.

On my local network I'm using the Squid caching proxy server and Dansguardian filter for all web traffic. I'm seeing nothing odd in the Dansguardian or Squid logs. When I avoid my local network and the proxy server, by connecting via a cellular connection, I have no problem in the same browser that I had a problem with.

I don't have problems with any other sites that I go to on the Internet.

Would be grateful for feedback.

Cheers,

Mark

RacingPete

8,884 posts

205 months

Monday 27th April 2015
quotequote all
Thanks for the in depth feedback - we will have a look and see if we can reproduce what is happening.

markp111

Original Poster:

5 posts

109 months

Monday 27th April 2015
quotequote all
Thanks. I just noticed a mistake in my report. It should have been:

I think that some javascript code is supposed to change this source:
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/Assets/bundles/commonstyles.css" />
to something like this:
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/2969/Assets/bundles/commonstyles.css" />

I.e. I'm seeing page source without the '2969' bit in the url, which I think is supposed to be put in by Javascript. Hence (I assume) I'm getting the "No Such Key" error in the css file when I try to view it.

Cheers,

Mark

RacingPete

8,884 posts

205 months

Monday 27th April 2015
quotequote all
The 2969 part is the build version of the software we have serving the site - so each css and js is versioned every time we build the solution and should have no reference without this path in it.

As you are seeing it is a little strange.

Can you let me know what pages you are seeing it on (or is it all of them?)
And when you view source of the page, are you are specifically seeing the no 2969 part in the URLs?

markp111

Original Poster:

5 posts

109 months

Monday 27th April 2015
quotequote all
Here:
http://www.pistonheads.com/classifieds/used-cars
I get no css rendering of the page - just an unstyled basic rendered html page and
the source that I get in my browsers includes:
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/Assets/bundles/commonstyles.css" />
and I when I click through to the css url I get a page with this source code:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>Assets/bundles/commonstyles.css</Key><RequestId>8954AFB6BCFF6EAD</RequestId><HostId>rmap/o3ogaP9lAS/qFJVlhSOlIgGFMfHC5uqfQvqVHtt7ULIKfAYk15BX442RKI+g90/O0DWVAc=</HostId></Error>

In Internet Explorer I have the same. With script debugging turned on in Internet Explorer I get no debug windows popping up to tell me of Javascript errors though.

When I view the page from outside my proxy server the page is rendered fine (with CSS) and the page source includes:
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/2969/Assets/bundles/commonstyles.css" />

The pistonheads home page displays fine, complete with proper css rendering. Except the classifieds widget displaying the url:
http://www.pistonheads.com/classifieds/homepagesea...
just displays javascript code like this:
[{"l":[{"n":"500","v":2209},{"n":"595","v":2210},{"n":"695","v":2212},{"n":"Punto Evo","v":2211}],"ChildSelected":

The css source code links in the home page are:
<link rel="stylesheet" type="text/css" href="/stylesheets/layout.css?v2840"> <!--[if IE]> <link rel="stylesheet" type="text/css" media="all" href="/stylesheets/layout.css?v2840"> <![endif]--> <link rel="stylesheet" type="text/css" href="/stylesheets/ie6.css?v1"><link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/2969/Assets/bundles/uhcss.css" />

Most (perhaps all) other pages render without the css styling. Including these pages:
http://www.pistonheads.com/car-servicing
http://www.pistonheads.com/features/ph-mydreamdriv...

'car-servicing' for example has source:
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/Assets/bundles/commonstyles.css" />
which doesn't have the build number.

So, If I go here:
http://static.pistonheads.com/Assets/bundles/commo...
I get 'NoSuchKey', but if I go here:
http://static.pistonheads.com/2969/Assets/bundles/...
I get css code.

If I bypass my proxy server and go here:
http://www.pistonheads.com/classifieds/used-cars
I get a css rendered page and the source includes
<link rel="stylesheet" type="text/css" href="http://static.pistonheads.com/2969/Assets/bundles/commonstyles.css" />
which contains the build number and returns a good css file.

If (whilst bypassing the proxy) I went to the problematic css url:
http://static.pistonheads.com/Assets/bundles/commo...
I still get 'NoSuchKey'

When I view a problematic page by visiting the Google cached version of the page, I see the full css rendered page and the css url includes 2969.

It makes it look like the build version is supposed to be in the css url, but for some reason, when I view it through my caching proxy server the build number isn't there.

RacingPete

8,884 posts

205 months

Monday 27th April 2015
quotequote all
It looks like your proxy is not sending through some of the http headers to our proxy server that directs the request to the correct resource in the code.

We have logic that will detect if the request is local (thus helps us develop locally) and then serve out the assets and bundles local to the developer. It looks like that logic is being triggered by the way the config is setup on your proxy.

This is an issue we need to address in the code ourselves, but we can suggest a workaround - if you add to the proxy the ability to pass through the X_Forwarded_For then you will get the site working properly.

The key not being available for the css without the version number is how we have the system setup - so that is expected behaviour.

markp111

Original Poster:

5 posts

109 months

Monday 27th April 2015
quotequote all
Bingo. That behaved exactly how you expected.

I added
forwarded_for transparent
to squid.conf
in my installation of Squid Cache 3.1.10

and now I get pistonheads completely as normal. So, I can get back to perusing the site, as is my want! smile

I understand what you mean about this being something you wish to fix at your end too.

Thanks for your help and I hope that it has been helpful for you too. If you want to ask me to check pistonheads.com with my old configuation, do ask.

Cheers,

Mark