chore: Dynamic CSP connect-src to support terminals connecting to workspace proxies (#7352)

* chore: Expose proxy hostnames to csp header
This commit is contained in:
Steven Masley
2023-05-02 08:30:44 -05:00
committed by GitHub
parent 465fe8658d
commit a1db82582f
6 changed files with 220 additions and 117 deletions

View File

@ -250,6 +250,10 @@ func New(ctx context.Context, options *Options) (*API, error) {
// Force the initial loading of the cache. Do this in a go routine in case
// the calls to the workspace proxies hang and this takes some time.
go api.forceWorkspaceProxyHealthUpdate(ctx)
// Use proxy health to return the healthy workspace proxy hostnames.
f := api.ProxyHealth.ProxyHosts
api.AGPL.WorkspaceProxyHostsFn.Store(&f)
}
err = api.updateEntitlements(ctx)