Summary of Cache-Related HTTP Headers

Long ago (long before the first post in this blog!) I’ve composed a list of cache-related HTTP headers, so I would not need to go through the trial-and-error process of guessing the right combination more than once. Recently I got another question about caching and it took me a lot of time to recall where I saw this list last time. So now I’m placing it here.

Please treat the explanations below as quick and incomplete summary. For full specification of “Pragma”, “Cache-Control” and “Expires” headers refer to HTTP/1.1 specification.

Caching in HTTP 1.1

Following directive does not prevent caching despite its name. It allows caching of the page, but specifies that the cache must ask the originating web server if the page is up-to-date before serving the cached version. So the cached page can still be served up if the originating web server says so. Applies to all caches.

Cache-Control: no-cache

Following directive tells the browser that the page has expired and must be treated as stale. Should be good news as long as the caches obey.

Expires: Thu, 01 Jan 1970 00:00:00 GMT

Following directive specifies that the page contains information intended for a single user only and must not be cached by a shared cache (e.g. a proxy server).

Cache-Control: private

Following directive specifies that a cache must not store any part of the response or the request that elicited it.

Cache-Control: no-store

Following directive tells the cache that the maximum acceptable staleness of a page is 0 seconds.

Cache-Control: max-stale=0

Caching in HTTP 1.0

Following directive is the only cache control directive for HTTP 1.0, so use it in addition to any HTTP 1.1 cache control headers you include.

Pragma: no-cache

Continue reading “Summary of Cache-Related HTTP Headers”

How to Use CDATA in Spring Configuration Entries

Today I had to create a map in Spring XML configuration file, where both keys and values ought to be XML elements by their own. Obviously, using CDATA is the most readable way to achieve that – but it was not immediately clear how to use CDATA for entry’s key and value attributes.

Here is what I ended with:

<util:map id="patterns">
  <entry>
    <key><value><![CDATA[<original>old-value</original>]]></value></key>
    <value><![CDATA[<replacement>new-value</replacement>]]></value>
  </entry>
</util:map>

Enjoy!

How to Download Eclipse Update Site for Offline Use

Unlike the early Eclipse days, now most of Eclipse plugins are distributed via Update Manager. Installation of new software is only a few clicks away – unless your development environment is not connected to the internet! Some vendors publish update site archives for offline use, but most of them are not. Eclipse tries to provide a solution for that with site mirroring, but is not as easy as it could be and forces you to install full-fledged Eclipse on a machine connected to the internet. So, what can you do about it?

Let’s take run-jetty-run – excellent plugin that allows you to run Jetty in Eclipse with a single click, including source attachment for debugging, – and prepare an offline update site for it. Continue reading “How to Download Eclipse Update Site for Offline Use”

Acrobat Reader: How to disable “Adobe ID” prompt

Adobe ID Sign In PromptFor many years I’m using Adobe Acrobat Reader to read PDF documents. Recently I started getting an annoying popup prompt for my Adobe ID while opening PDFs. I don’t have one and don’t plan to get one – it is just useless to me at this point.

[ Disclaimer: This worked for me with Adobe Acrobat Reader 11. Now I’m using Reader DC, but I’ve never got Adobe ID login prompt here and I don’t know why. ]

Here is the way to get rid of this prompt:

  1. Open Registry Editor (and be extra careful there!)
  2. Go to “HKEY_CURRENT_USER\Software\Adobe\Acrobat Reader\11.0\Workflows” (if you don’t have “Workflows” key, just create one)
  3. Create new “DWORD (32-bit)” Value with name “bEnableAcrobatHS” and value “0”

That’s all – short and simple!

Continue reading “Acrobat Reader: How to disable “Adobe ID” prompt”

How to Install PFX Certificate on NetScaler

OpenSSL From time to time I have to create a new virtual server on my NetScaler box, along with a new SSL certificate. Recent NetScaler versions provide you an easy option to create a test certificate with one click, but at some point you will need a real certificate there. In may cases the certificate you have is in FPX (aka PKCS#12) format, while NetScaler requires certificate and key pair in PEM or DES format. Solving this puzzle may not be so easy.

Fortunately, NetScaler itself comes with embedded OpenSSL support, and the following steps will help you handle certificate installation task even without deep OpenSSL knowledge.

root@ns1#
root@ns1# pwd
/nsconfig/ssl
root@ns1# ls my-test*
my-test.pfx
root@ns1# openssl pkcs12 -nokeys -in my-test.pfx -out my-test.cert
Enter Import Password:
MAC verified OK
root@ns1# openssl pkcs12 -nocerts -nodes -in my-test.pfx -out my-test.key
Enter Import Password:
MAC verified OK
root@ns1# ls my-test*
my-test.cert    my-test.key     my-test.pfx
root@ns1#
root@ns1#

Pay attention to the highlighted lines above – those are the commands that create certificate and keys files respectively. Continue reading “How to Install PFX Certificate on NetScaler”