s c h e m a t i c s : c o o k b o o k

/ Cookbook.WebPreventCaching

This Web


WebHome 
WebChanges 
TOC (with recipes)
NewRecipe 
WebTopicList 
WebStatistics 

Other Webs


Chicken
Cookbook
Erlang
Know
Main
Plugins
Sandbox
Scm
TWiki  

Schematics


Schematics Home
Sourceforge Page
SchemeWiki.org
Original Cookbook
RSS

Scheme Links


Schemers.org
Scheme FAQ
R5RS
SRFIs
Scheme Cross Reference
PLT Scheme SISC
Scheme48 SCM
MIT Scheme scsh
JScheme Kawa
Chicken Guile
Bigloo Tiny
Gambit LispMe
GaucheChez

Lambda the Ultimate
TWiki.org

Preventing Caching of Web Pages

Problem

In a continuation-based web application, URLs are rewritten to refer to continuations. If you don't take care to prevent caching of pages, the browser will load pages from its cache that contain stale URLs. This is a problem primarily for the entry point to a web application, as further URLs generated by the application will be unique (due to the inclusion of the continuation's encoding), and hence cannot be cached by the browser.

Solution

You can send several HTTP headers that disable caching in most browsers. To send HTTP headers in the PLT Web Server, you use the function make-response/full:

(make-response/full 200
                    "OK"
                    (current-seconds)
                    #"text/html"
                    '((Cache-Control . "no-cache")
                      (Pragma . "no-cache"))
                    <the content as a list of strings>)

Discussion

To convert a XEXPR to a string, use the function xexpr->string.


Comments about this recipe

Contributors

-- NoelWelsh - 19 Nov 2004

CookbookForm
TopicType: Recipe
ParentTopic: WebRecipes
TopicOrder: 999

 
 
Copyright © 2004 by the contributing authors. All material on the Schematics Cookbook web site is the property of the contributing authors.
The copyright for certain compilations of material taken from this website is held by the SchematicsEditorsGroup - see ContributorAgreement & LGPL.
Other than such compilations, this material can be redistributed and/or modified under the terms of the GNU Lesser General Public License (LGPL), version 2.1, as published by the Free Software Foundation.
Ideas, requests, problems regarding Schematics Cookbook? Send feedback.
/ You are Main.guest