Merge pull request #454 from dlthomas/master

Prevent caching of redirects
This commit is contained in:
Michael Snoyman 2012-11-25 11:34:25 -08:00
commit 918e3c9d2e

View File

@ -522,7 +522,12 @@ runHandler handler mrender sroute tomr master sub upload log' =
Right c' -> return $ YARPlain status (appEndo headers []) ct c' finalSession
HCError e -> handleError e
HCRedirect status loc -> do
let hs = Header "Location" (encodeUtf8 loc) : appEndo headers []
let disable_caching =
[ Header "Cache-Control" "no-cache, must-revalidate"
, Header "Expires" "Thu, 01 Jan 1970 05:05:05 GMT"
]
hs = (if status /= H.movedPermanently301 then disable_caching else [])
++ Header "Location" (encodeUtf8 loc) : appEndo headers []
return $ YARPlain
status hs typePlain emptyContent
finalSession