CodeWork
CLI

Behind a Proxy

Reach codework serve over TLS through a reverse proxy or tunnel.

Plain HTTP

codework serve speaks plain HTTP. TLS is the proxy’s job: it ends TLS and forwards to the server.

What the proxy sends

Header or routeWhy
HostPassed through as the client sent it
X-Forwarded-Proto: httpsTells the server the client connected over TLS
WebSocket upgrade on /rpc/v1The app’s connection to the server

Trusted proxies

The server believes X-Forwarded-Proto only from loopback or a trusted proxy. When the proxy reaches the server from another address, name it, as an address or a CIDR range:

WhereExample
Flagcodework serve --trusted-proxy 172.18.0.0/16
EnvironmentCODEWORK_TRUSTED_PROXY=172.18.0.0/16,10.0.0.5
User settings.jsonc{ "server": { "trustedProxy": ["172.18.0.0/16"] } }

The flag wins over the environment, and the environment over settings. Only the user settings file is read; a project’s is not.

NGINX

location / {
	proxy_pass http://127.0.0.1:7433;
	proxy_http_version 1.1;
	proxy_set_header Host $host;
	proxy_set_header X-Forwarded-Proto $scheme;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "upgrade";
}

Other setups

SetupWhat to do
Tunnel agent on the same machineNothing: it connects from loopback
Proxy in another containerTrust the container’s address
Platform edge proxyTrust the platform’s internal range

codework service devices shows, per paired device, whether its last connection was encrypted.