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/f2adf5e4-5486-4bbe-9860-a6639a1142e6%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/f2adf5e4-5486-4bbe-9860-a6639a1142e6%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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%3D8dYiTCS6-vd6vCY6x8bcEMSNaBKYyKtvA3jKTX5cs4hQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
