fix: disable browser caching on dev proxy responses

CSS/JS changes were not reflected through the proxy because the browser/
WebView cached them. Set Cache-Control: no-cache, no-store, must-revalidate
and strip ETag/Last-Modified on all dev proxy responses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
dj-oyu 2026-02-22 21:34:33 +09:00
parent 6a84e5ffd6
commit a5ccc1166a

View file

@ -280,6 +280,11 @@ func (h *Handler) ActivateDevTarget(id string) error {
proxy := httputil.NewSingleHostReverseProxy(u)
proxy.ModifyResponse = func(resp *http.Response) error {
// Prevent browser/WebView from caching dev proxy responses (CSS, JS, etc.)
resp.Header.Set("Cache-Control", "no-cache, no-store, must-revalidate")
resp.Header.Del("ETag")
resp.Header.Del("Last-Modified")
ct := resp.Header.Get("Content-Type")
if !strings.Contains(ct, "text/html") {
return nil