No what I have said is the enterprise or standard way of doing it.the functionality you are looking for is not specific to any programming language. It is with the http headrers which is standard across all platforms. But if you really want to do in your app you need to cache-control header in your go response. Read more about http cache-control header you will know.
Thanks and regards, Satyendra On Sun, 19 May, 2019, 7:33 PM Tong Sun, <[email protected]> wrote: > Sorry I don't quite understand -- my go application IS my webserver. > > Are you saying Go net/http is not capable of doing what I'm asking? > > On Sun, May 19, 2019 at 9:59 AM satyendra singh > <[email protected]> wrote: > > > > Hi Tong, > > You can use a webserver between browser and your go application which > will take care of header modification for browser caching. > > > > Thanks and regards, > > Satyendra > > > > On Sun, 19 May, 2019, 7:26 PM Tong Sun, <[email protected]> wrote: > >> > >> Hi, > >> > >> How to have http.Handle / http.HandleFunc to produce static content > that browser will use their caches without downloading every time? > >> > >> For a simplest http.HandleFunc, like the following, > >> > >> func sayHello(w http.ResponseWriter, r *http.Request) { > >> message := "Hello " > >> > >> w.Write([]byte(message)) > >> } > >> > >> > >> > >> Thet HTTP Header it produce is: > >> > >> HTTP/1.1 200 OK > >> Date: Sun, 19 May 2019 13:46:32 GMT > >> Content-Length: 6 > >> Content-Type: text/plain; charset=utf-8 > >> > >> > >> I.e., the "Date:" part is changing all the time, even if I've added a > "last-modified" Header field. > >> > >> What's the solution? Thx > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAEpYQ%3D-CfFAkH2_LnOMu1%3D31Lovw_jw%2B0pXU%3DPuDQug5JQ6pqQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
