last-modified caching interferes with debug

master
Ted Unangst 5 years ago
parent 53aa979d5b
commit 659d2b9ebc

@ -177,8 +177,10 @@ func homepage(w http.ResponseWriter, r *http.Request) {
if len(honks) > 0 {
modtime = honks[0].Date
}
debug := false
getconfig("debug", &debug)
imh := r.Header.Get("If-Modified-Since")
if imh != "" && !modtime.IsZero() {
if !debug && imh != "" && !modtime.IsZero() {
ifmod, err := time.Parse(http.TimeFormat, imh)
if err == nil && !modtime.After(ifmod) {
w.WriteHeader(http.StatusNotModified)

@ -2,7 +2,7 @@
<button onclick="showhonkform(); return false"><a href="/newhonk">it's honking time</a></button>
<form id="honkform" action="/honk" method="POST" enctype="multipart/form-data" style="display: none">
<p></p>
<input type="hidden" name="rid" value="">
ly: <input type="text" name="rid" value="">
<input type="hidden" name="CSRF" value="{{ .HonkCSRF }}">
<textarea name="noise" id="honknoise"></textarea>
<p>

Loading…
Cancel
Save