code-server + caddy reverse proxy
Hello everyone, I've been trying to setup a reverse proxy for code-server.
I have the following config (Caddyfile):
``` :80
route / { # it's for hello world reverse_proxy :12345 }
route /vscode { reverse_proxy localhost:4200 } ```
and this code-server yaml config:
bind-addr: 127.0.0.1:4200
auth: password
password: <my pwd>
cert: false
/ works, it shows "Hello World" as intended.
but when I go to /vscode - it throws 404
Any ideas why it happens? is it a code-server problem, or caddy problem?
9 comments · 100% upvoted · other discussions
you need to add websockets into your proxy config for code-server.
``` http://ip/domain.tld { ## THIS is what you need for your config to work. proxy / 192.168.0.115:8080 { websocket transparent }
}
```
pretty much the only reason why i am not using 127.0.0.1 is because caddyserver runs in a docker container.
[deleted] 1 points · May 2020
is domain.tld a file or I need to write my site domain there?
merith-tk 1 points · May 2020
domain.tld is a placeholder for a website domain the
.comis called a tldalso side note, this is a caddy v1 config so i dont know if this works for you because i am in the process of upgrading my v1 configs to v2
[deleted] 1 points · May 2020
hm thanks for help, I'll try asking on caddy forums
and if you make it work with v2 - let me know!
merith-tk 1 points · May 2020
got it to work with v2 when i ported my configs over, kinda annoyed at the fact that the
errorsdirective is removed but eh ``` https://code.example.com { tls /opt/caddy/cert/pub /opt/caddy/cert/priv basicauth /* { user <place password hash here, acquired by "caddy hash-password -plaintext <your password>> } reverse_proxy 192.168.0.115:8080}