Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cf97b34

Browse files
committedApr 16, 2025··
feat: support --proxy-domain
1 parent de16ef3 commit cf97b34

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed
 

‎src/code-server/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ VS Code in the browser
3333
| locale | Set VS Code display language and language shown on the login page. Format should be an IETF language tag (e.g., 'en', 'fr', 'zh-CN'). | string | - |
3434
| logFile | Path to a file to send stdout and stderr logs to from code-server. | string | /tmp/code-server.log |
3535
| port | The port to bind to for the code-server. | string | 8080 |
36+
| proxyDomain | Domain used for proxying ports. | string | - |
3637
| socket | Path to a socket. When specified, host and port will be ignored. | string | - |
3738
| socketMode | File mode of the socket when using the socket option. | string | - |
3839
| trustedOrigins | Comma-separated list of trusted-origins to disable origin check for. Useful if not able to access reverse proxy configuration. | string | - |

‎src/code-server/devcontainer-feature.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@
9595
"default": "8080",
9696
"description": "The port to bind to for the code-server."
9797
},
98+
"proxyDomain": {
99+
"type": "string",
100+
"default": "",
101+
"description": "Domain used for proxying ports."
102+
},
98103
"socket": {
99104
"type": "string",
100105
"default": "",

‎src/code-server/install.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ for extension in "${proposed_api_extensions[@]}"; do
105105
FLAGS+=(--enable-proposed-api "$extension")
106106
done
107107

108+
if [[ "$PROXYDOMAIN" ]]; then
109+
FLAGS+=(--proxy-domain "$PROXYDOMAIN")
110+
fi
111+
108112
cat > /usr/local/bin/code-server-entrypoint <<EOF
109113
#!/usr/bin/env bash
110114
set -e
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
# Feature-specific tests
8+
check "code-server version" code-server --version
9+
check "code-server running" pgrep -f 'code-server/lib/node.*/code-server'
10+
check "code-server listening" lsof -i "@127.0.0.1:8080"
11+
12+
check "code-server proxy-domain" grep '"--proxy-domain".*"dev.coder.com"' < /usr/local/bin/code-server-entrypoint
13+
14+
# Report results
15+
reportResults

‎test/code-server/scenarios.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,5 +219,13 @@
219219
]
220220
}
221221
}
222+
},
223+
"code-server-proxy-domain": {
224+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
225+
"features": {
226+
"code-server": {
227+
"proxyDomain": "dev.coder.com"
228+
}
229+
}
222230
}
223231
}

0 commit comments

Comments
 (0)
Please sign in to comment.