though, it only proxies on http and ws. I’m a bit lost why I can’t connect through wss or https ?!
also, if I just do this reverse_proxy localhost:6000 in Caddyfile, I get the following error:
Error: loading initial config: loading new config: http app module: start: listening on :6000: listen tcp :6000: bind: address already in use
I am setting using the following commands:
wscat -c 'ws://localhost:2015/chat?username=foo'
curl 'http://localhost:2015/version'
the error I get for wss is
wscat -c 'wss://localhost:2015/chat?username=foo'
error: write EPROTO C0D76DAA167F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:
Caddy will default to listening for HTTPS if you use a valid domain name as your site address. If you use a non-standard port, it will only listen for HTTP. See the docs: Caddyfile Concepts — Caddy Documentation
The reason you get that error if you remove :2015 is because it becomes an invalid Caddyfile. See the docs page above, it explains how the Caddyfile is structured. You must have a site address as the first thing (except for global options and snippets).
FYI, wss is not a real protocol scheme, is just a shortcut in the browser to mean “WebSockets over HTTPS”. In reality, it’s just an HTTPS connection to start, which gets upgraded to a raw TCP connection (with TLS) after the handshake.