microsoft / microsoft/vscode

Wrong Content-Security-Policy header for serve-web

Open
#334,872 3 comments 0 reactions 1 assignee Claimed by @chrmarti View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Does this issue occur when all extensions are disabled?: Yes

- VS Code Version: 1.136.0
- OS Version: Ubuntu

> [!NOTE]
> This is an error config related to the serve-web feature

**Problem Description**:
The serve-web feature (denote as code-server below) sets Content-Security-Policy to `http://`. For example, if the hostname is `example.com`, then the Content-Security-Policy response header contains `http://example.com`. This usually OK, however, when the browser-side actual scheme is HTTPS (e.g. connect over a reverse proxy), the Content-Security-Policy blocks any resource to load

Steps to Reproduce:

1. `code serve-web`
2. Connect over https reverse proxy
3. Got blank page with lots of CSP violations

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.