Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
32 lines (25 sloc) 892 Bytes
package main
import (
func NoBrowserCacheFilter(req *restful.Request, resp *restful.Response, chain *restful.FilterChain) {
resp.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") // HTTP 1.1.
resp.Header().Set("Pragma", "no-cache") // HTTP 1.0.
resp.Header().Set("Expires", "0") // Proxies.
chain.ProcessFilter(req, resp)
// This example shows how to use a WebService filter that passed the Http headers to disable browser cacheing.
// GET http://localhost:8080/hello
func main() {
ws := new(restful.WebService)
http.ListenAndServe(":8080", nil)
func hello(req *restful.Request, resp *restful.Response) {
io.WriteString(resp, "world")
You can’t perform that action at this time.