[hunchentoot-devel] ETag, Cache-Control, and/or Expires headers
Patrick May
patrick.may at mac.com
Tue Jul 7 01:19:20 UTC 2009
Since I have the list all to myself tonight, here's the answer I came
up with:
(defun register-uncached-static-file (name &optional (path *web-path*)
content-type)
"Register a static file with Hunchentoot, setting the headers to
prevent caching. Dispatcher and handler code lifted from
hunchentoot:create-static-file-dispatcher-and-handler."
(push (lambda (request) ; the dispatcher
(when (equal (hunchentoot:script-name request)
(concatenate 'string "/" name))
(lambda () ; the handler
(hunchentoot:no-cache)
(hunchentoot:handle-static-file
(concatenate 'string path "/" name)
content-type))))
hunchentoot:*dispatch-table*))
Comments solicited and appreciated.
Regards,
Patrick
On 6 Jul 2009, at 20:43, Patrick May wrote:
> Sorry. I mean create-static-file-dispatcher-and-handler, not
> register-static-file.
>
> Thanks,
>
> Patrick
>
> On 6 Jul 2009, at 20:24, Patrick May wrote:
>
>> I need to prevent an intermediate cache from caching a static audio
>> file I'm providing via register-static-file. What's the easiest way
>> to set these for every reply (changing it dynamically, in the case of
>> ETag)?
>>
>> Thanks,
>>
>> Patrick
>>
>>
>> _______________________________________________
>> tbnl-devel site list
>> tbnl-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
More information about the Tbnl-devel
mailing list