Created
September 25, 2014 13:14
-
-
Save timyates/f2ac8f8c7bfa4f728c2e to your computer and use it in GitHub Desktop.
Cache control in Ratpack with Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chain(context -> { | |
handler(ctx -> { | |
ctx.getResponse().getHeaders().set("Pragma", "No-cache"); | |
ctx.getResponse().getHeaders().set("Cache-Control", "no-cache,no-store,max-age=0"); | |
ctx.getResponse().getHeaders().setDate("Expires", new Date(LocalDate.ofEpochDay(0).atStartOfDay().toInstant(ZoneOffset.UTC).toEpochMilli())); | |
ctx.next(); | |
}); | |
assets("public"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment