Compare commits
4 Commits
2.1478-vsc
...
2.1485-vsc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef069d9b0e | ||
|
|
6a864f9f47 | ||
|
|
5c16399810 | ||
|
|
0141ded35d |
@@ -46,12 +46,66 @@ server {
|
|||||||
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
|
RewriteRule /(.*) http://localhost:8080/$1 [P,L]
|
||||||
|
|
||||||
ProxyRequests off
|
ProxyRequests off
|
||||||
|
ProxyPass / http://localhost:8080/ nocanon
|
||||||
RequestHeader set X-Forwarded-Proto https
|
|
||||||
RequestHeader set X-Forwarded-Port 443
|
|
||||||
|
|
||||||
ProxyPass / http://localhost:8080/ nocanon
|
|
||||||
ProxyPassReverse / http://localhost:8080/
|
ProxyPassReverse / http://localhost:8080/
|
||||||
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Run automatically at startup
|
||||||
|
|
||||||
|
In some cases you might need to run code-server automatically once the host starts. You may use your local init service to do so.
|
||||||
|
|
||||||
|
#### Systemd
|
||||||
|
|
||||||
|
```ini
|
||||||
|
[Unit]
|
||||||
|
|
||||||
|
Description=VSCode in a browser
|
||||||
|
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
ExecStart=/usr/bin/code-server $(pwd)
|
||||||
|
|
||||||
|
WorkingDirectory=$HOME/projects
|
||||||
|
|
||||||
|
ExecStop=/sbin/start-stop-daemon --stop -x /usr/bin/code-server
|
||||||
|
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
User=1000
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
```
|
||||||
|
|
||||||
|
#### OpenRC
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
after net-online
|
||||||
|
need net
|
||||||
|
}
|
||||||
|
|
||||||
|
supervisor=supervise-daemon
|
||||||
|
name="code-server"
|
||||||
|
command="/opt/cdr/code-server"
|
||||||
|
command_args=""
|
||||||
|
|
||||||
|
pidfile="/var/run/cdr.pid"
|
||||||
|
respawn_delay=5
|
||||||
|
|
||||||
|
set -o allexport
|
||||||
|
if [ -f /etc/environment ]; then source /etc/environment; fi
|
||||||
|
set +o allexport
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Kubernetes/Docker
|
||||||
|
|
||||||
|
Make sure you set your restart policy to always - this will ensure your container starts as the daemon starts.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"patch:apply": "yarn ensure-in-vscode && cd ../../../ && git apply ./src/vs/server/scripts/vscode.patch"
|
"patch:apply": "yarn ensure-in-vscode && cd ../../../ && git apply ./src/vs/server/scripts/vscode.patch"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@coder/nbin": "^1.2.0",
|
"@coder/nbin": "^1.2.2",
|
||||||
"@types/pem": "^1.9.5",
|
"@types/pem": "^1.9.5",
|
||||||
"@types/safe-compare": "^1.1.0",
|
"@types/safe-compare": "^1.1.0",
|
||||||
"@types/tar-fs": "^1.16.1",
|
"@types/tar-fs": "^1.16.1",
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ export class FileProviderChannel implements IServerChannel, IDisposable {
|
|||||||
|
|
||||||
private transform(resource: UriComponents): URI {
|
private transform(resource: UriComponents): URI {
|
||||||
// Used for walkthrough content.
|
// Used for walkthrough content.
|
||||||
if (resource.path.indexOf("/static") === 0) {
|
if (/^\/static[^/]*\//.test(resource.path)) {
|
||||||
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static/, ""));
|
return URI.file(this.environmentService.appRoot + resource.path.replace(/^\/static[^/]*\//, "/"));
|
||||||
// Used by the webview service worker to load resources.
|
// Used by the webview service worker to load resources.
|
||||||
} else if (resource.path === "/vscode-resource" && resource.query) {
|
} else if (resource.path === "/vscode-resource" && resource.query) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ export abstract class Server {
|
|||||||
// without adding query parameters which have their own issues.
|
// without adding query parameters which have their own issues.
|
||||||
// REVIEW: Discuss whether this is the best option; this is sort of a quick
|
// REVIEW: Discuss whether this is the best option; this is sort of a quick
|
||||||
// hack almost to get caching in the meantime but it does work pretty well.
|
// hack almost to get caching in the meantime but it does work pretty well.
|
||||||
if (/static-.+/.test(base)) {
|
if (/^\/static-.+/.test(base)) {
|
||||||
base = "/static";
|
base = "/static";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,7 +331,7 @@ export abstract class Server {
|
|||||||
this.ensureGet(request);
|
this.ensureGet(request);
|
||||||
if (!this.authenticate(request)) {
|
if (!this.authenticate(request)) {
|
||||||
throw new HttpError("Unauthorized", HttpCode.Unauthorized);
|
throw new HttpError("Unauthorized", HttpCode.Unauthorized);
|
||||||
} else if (request.headers.upgrade !== "websocket") {
|
} else if (!request.headers.upgrade || request.headers.upgrade.toLowerCase() !== "websocket") {
|
||||||
throw new Error("HTTP/1.1 400 Bad Request");
|
throw new Error("HTTP/1.1 400 Bad Request");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.8.tgz#416a7221d84161ee35eca9cfa93ba9377639b4ee"
|
resolved "https://registry.yarnpkg.com/@coder/logger/-/logger-1.1.8.tgz#416a7221d84161ee35eca9cfa93ba9377639b4ee"
|
||||||
integrity sha512-NJDC4rZTx0deVYqAxZtJWACq3IrVR59BjFeZebO3i7OfTZZMkkbLsGsCFMnJd5KnX6KjnvvFq4XXtwJ9yf8/YQ==
|
integrity sha512-NJDC4rZTx0deVYqAxZtJWACq3IrVR59BjFeZebO3i7OfTZZMkkbLsGsCFMnJd5KnX6KjnvvFq4XXtwJ9yf8/YQ==
|
||||||
|
|
||||||
"@coder/nbin@^1.2.0":
|
"@coder/nbin@^1.2.2":
|
||||||
version "1.2.0"
|
version "1.2.2"
|
||||||
resolved "https://registry.yarnpkg.com/@coder/nbin/-/nbin-1.2.0.tgz#b1cc5ed51193ded98ccfe39825ceee500b90f849"
|
resolved "https://registry.yarnpkg.com/@coder/nbin/-/nbin-1.2.2.tgz#c5f9aaa2a0e84c2a13a4cce895547efbd66730b7"
|
||||||
integrity sha512-fHnOqx1yAuK65gr1D9Du7W4AXiITEcFPKIZ3JifvXMeSSwzdVzq3nvVSCPD45KTwK1nS6pDKkXC/CqrYinUf7Q==
|
integrity sha512-1Z6aYBRZRY1AQ2xp0jmoz+TXR8M4WaHa9FfVkOPej0KPJjYtEp18I+/6CmffDtBLxSnIai0rc+AA0VhbjCN/rg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@coder/logger" "^1.1.8"
|
"@coder/logger" "^1.1.8"
|
||||||
fs-extra "^7.0.1"
|
fs-extra "^7.0.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user