linuxserver / docker-code-server

GNU General Public License v3.0
1.54k stars 314 forks source link

[BUG] Environment PROXY_DOMAIN not working well #155

Closed afdhal395 closed 12 months ago

afdhal395 commented 12 months ago

Is there an existing issue for this?

Current Behavior

When PROXY_DOMAIN is set, the proxy link misbehaved as screenshot below.

image

Expected Behavior

The generated link should be in the format http://:

Steps To Reproduce

  1. Set PROXY_DOMAIN var in docker compose.
  2. Run docker-compose up.

Environment

- OS:Ubuntu 22.04
- How docker service was installed: Docker official doc

CPU architecture

x86-64

Docker creation

version: "2.1"

volumes:
  code-server:
    driver: local

services:
  code-server:
    image: lscr.io/linuxserver/code-server:latest
    container_name: code-server
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
      - PASSWORD=$PASSWORD #optional
      - HASHED_PASSWORD= #optional
      - SUDO_PASSWORD=$PASSWORD #optional
      - SUDO_PASSWORD_HASH= #optional
      - PROXY_DOMAIN=$DOMAIN #optional
      - DEFAULT_WORKSPACE=/config/workspace #optional
    volumes:
      - code-server:/config
    ports:
      - 8443:8443
    restart: unless-stopped

Container logs

[migrations] started
[migrations] no migrations found
───────────────────────────────────────
      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 
   Brought to you by linuxserver.io
───────────────────────────────────────
To support LSIO projects visit:
https://www.linuxserver.io/donate/
───────────────────────────────────────
GID/UID
───────────────────────────────────────
User UID:    1000
User GID:    1000
───────────────────────────────────────
setting up sudo access
adding abc to sudoers
setting sudo password using SUDO_PASSWORD env var
New password: Retype new password: passwd: password updated successfully
[custom-init] No custom files found, skipping...
[2023-07-11T12:41:38.370Z] info  code-server 4.14.1 5c199629305a0b935b4388b7db549f77eae82b5a
[2023-07-11T12:41:38.376Z] info  Using user-data-dir ~/data
[2023-07-11T12:41:38.398Z] info  Using config file ~/.config/code-server/config.yaml
[2023-07-11T12:41:38.398Z] info  HTTP server listening on http://0.0.0.0:8443/
[2023-07-11T12:41:38.399Z] info    - Authentication is enabled
[2023-07-11T12:41:38.400Z] info      - Using password from $PASSWORD
[2023-07-11T12:41:38.401Z] info    - Not serving HTTPS
[2023-07-11T12:41:38.401Z] info    - Proxying the following domain:
[2023-07-11T12:41:38.402Z] info      - {{port}}.test-code.mydomain.com
[2023-07-11T12:41:38.403Z] info  Using proxy URI in PORTS tab: //{{port}}.test-code.mydomain.com
[2023-07-11T12:41:38.404Z] info  Session server listening on /config/data/code-server-ipc.sock
[ls.io-init] done.
[12:47:34] 
[12:47:34] Extension host agent started.
File not found: /app/code-server/lib/vscode/out/vsda_bg.wasm
File not found: /app/code-server/lib/vscode/out/vsda.js
[12:48:07] [172.19.0.1][fcdb5a35][ManagementConnection] New connection established.
[12:48:09] Using the in-memory credential store as the operating system's credential store could not be accessed. Please see https://aka.ms/vscode-server-keyring on how to set this up. Details: libsecret-1.so.0: cannot open shared object file: No such file or directory
[12:48:12] [172.19.0.1][0d445cb8][ExtensionHostConnection] New connection established.
[12:48:12] [172.19.0.1][0d445cb8][ExtensionHostConnection] <1201> Launched Extension Host Process.
github-actions[bot] commented 12 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

aptalca commented 12 months ago

That's all controlled by code-server so it should be reported to them

lordcheeto commented 6 months ago

In case someone else stumbles on this, this does work.

You need DNS records for the base url and port-prefixed url. Using the example above:

NAME TYPE VALUE
8000.test-code.mydomain.com CNAME test-code.mydomain.com
test-code.mydomain.com A \<server-ip-address>

This works with local DNS set up by Pi-hole, and should work for public domain registrars as well.