11

I am working at a customer with rather restrictive Internet access. I didn't have any problems with Stack Exchange websites so far (except Anime & Manga and Arqade). But now it seems the CSS is blocked due to the "v" URL parameter making it look like dynamic content and thus harmful:

http://cdn.sstatic.net/Sites/stackoverflow/all.css?v=f46e20d518dc

If I access the CSS without the parameter the firewall lets the CSS through, so I'm assuming this was added recently (I never checked it before).

So can it be removed again or any suggestions on how I can access the page with CSS nonetheless?

7
  • 12
    It's probably to avoid caching issues. Changing the parameter forces the clients to download the CSS again.
    – Floern
    Sep 20, 2016 at 8:43
  • 3
    recent like since 2009? - meta.stackexchange.com/questions/25929/…
    – YOU
    Sep 20, 2016 at 9:34
  • 1
    Any chance of getting the customer to whitelist the site? Are you able to install an addon to your browser to use custom stylesheets?
    – BSMP
    Sep 20, 2016 at 15:14
  • 14
    Ah, the irony of blocking the static content of a dynamic website because dynamic somehow equals harmful. Whoever made this rule clearly lacks basic understanding of how the web works. Sep 20, 2016 at 16:43
  • 8
    Please, by all means, tell the people responsible for this to visit this question so that we may mock them mercilessly.
    – user1228
    Sep 20, 2016 at 20:07
  • today it works again, strange policy they have in place there...
    – Thomas
    Sep 21, 2016 at 7:30
  • and today it blocks the JS for the Inbox and achievements click events, e.g. the ajax call triggered by it...
    – Thomas
    Sep 22, 2016 at 8:07

1 Answer 1

30

We deploy several times a day - some of these updates could be to CSS.

Our CSS is cached - on multiple levels (CDN, proxies, your browser).

In order to ensure that you get the newest CSS (and JavaScript), we need to "cache bust" - that is, ensure that the browser (and all caching proxies and the CDN) will get a fresh copy of the file. This is done by appending a parameter to the URL (the v - for version) - when a file changes, the value changes.

This is very common practice - and not something we will change. This is overly restrictive of your client - sorry if it is causing problems.

6
  • ok, that makes sense. Strange is only that it used to work before and now it doesn't. But there would be a better way to do it, add the timestamp or key before the extension e.g. all.f46e20d518dc.css So it can still be cached if the same version is requested
    – Thomas
    Sep 20, 2016 at 15:39
  • 3
    I would call it best practice more than common practice. I do this too, and it works very well. Cache busting is very important to ensure everyone is using the same version pushed, not only in css, but in other content too (hint:js). Also, to note, the browser does cache the resource with the v property, so there is no need to use all.(v).css. All that is needed is to change the value of v when you want to break the cache, it is a good approach to use.
    – Travis J
    Sep 20, 2016 at 18:45
  • @Thomas, I realize that you said it is working again, however I wanted to point out why your suggestion here is less than ideal. Notice how your suggestion changes the actual name of the file? That means the filename in the HTML (or javascript) now has to be modified. Although that can be done programatically, it is one more possible point of failure that then has to be tested. Sep 21, 2016 at 22:05
  • @AndrewSteitz hm, but it seems the v parameter is added the same way, so I see no difference between the two, except my approach is more forgiving with "stupid" network policies in some places. I am used to this with the REST framework Sling where these parts before the extensions are called selectors.
    – Thomas
    Sep 22, 2016 at 8:03
  • 1
    @Thomas - the big difference has to do with cached HTML. If it references the old file, it will not exist using your scheme - in our scheme, worst case is one gets an old version (blocking like you experience not withstanding).
    – Oded
    Sep 22, 2016 at 9:17
  • @Thomas, you are 100% correct that my comment made no difference whatsoever! ;-) Must have been tired when I posted it because I was thinking along the lines of Oded's explanation but obviously did not write it in a way that even came close. Sep 28, 2016 at 3:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .