Skip to content

Add --disable-file-cache to keep workspace files out of the browser cache #8084

Open

Description

@acpiper

What is your suggestion?

Add a --disable-file-cache flag. When it is set, code-server and the webview resource loader do not let the browser store workspace files on the client disk:

  • In the webview resource loader, send no ETag for a resource outside the webview's own extension location (webviewElement.ts, did-load-resource). The webview service worker stores a response only when it has an ETag (service-worker.js, shouldTryCaching && entry.etag), so workspace files do not go into Cache Storage.
  • Serve /vscode-remote-resource with Cache-Control: no-store for paths outside the extension directories (remoteExtensionHostAgentServer.ts, which uses CacheControl.ETAG today).

Extension scripts and styles keep their ETags, so webviews still load extension code from the cache. The flag is off by default.

Why do you want this feature?

--disable-file-downloads stops the user from saving workspace files through the UI. The browser still writes some workspace files to the client disk during normal use. I tested 4.143.1 with a persistent Chromium profile and searched the profile on disk for marker strings from workspace files:

  • An image shown in the Markdown preview, and a CSS file that a Markdown file links to, were in the webview service worker's Cache Storage (vscode-resource-cache-*). Cache-Control: no-store from a reverse proxy did not change this.
  • A file fetched from /vscode-remote-resource was in the HTTP disk cache. Cache-Control: no-store removed it.
  • Opened, edited, unsaved and searched text files were not on the client disk. Backups and local history stay on the server.

Teams that work with confidential files (for example, data under NDA) need these files kept off client disks. A lost laptop then does not expose the files.

Are there any workarounds to get this functionality today?

  • A browser profile that does not keep site data (for example, incognito) removes everything, but it also stops caching for code-server's static assets and extension code.
  • A reverse proxy can add Cache-Control: no-store, but this does not affect the webview service worker cache.
  • Full-disk encryption on the client protects the cache at rest. It does not keep the files off the disk.

Are you interested in submitting a PR for this?

Yes.

Activity

  1. linear-code commented on Oct 28, 2026

    @linear-code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions