client/web: cache csrf key when running in CGI mode

Indicate to the web client when it is running in CGI mode, and if it is
then cache the csrf key between requests.

Updates tailscale/corp#13775

Signed-off-by: Will Norris <will@tailscale.com>
This commit is contained in:
Will Norris
2023-08-23 15:22:24 -07:00
committed by Will Norris
parent 46b0c9168f
commit 824cd02d6d
3 changed files with 63 additions and 15 deletions

View File

@@ -30,7 +30,10 @@ func main() {
}
// Serve the Tailscale web client.
ws, cleanup := web.NewServer(*devMode, lc)
ws, cleanup := web.NewServer(web.ServerOpts{
DevMode: *devMode,
LocalClient: lc,
})
defer cleanup()
log.Printf("Serving Tailscale web client on http://%s", *addr)
if err := http.ListenAndServe(*addr, ws); err != nil {