Coder behind Reverse Proxy and Port Forwarding
Good evening everyone, just a quick question since I'm kinda Stuck: Does Coder Server need any open Ports besides 443 by default? 80 should only be used for Let's Encrypt but since I'm using DNS Challenge it shouldn't matter. Or am I missing something?
To clarify, my current setup is as follows:
Router with Port Forwarding -> Reverse Proxy -> Coder Server
I'm forwarding port 443 currently but I either get certificate errors or bad Gateway. According to my browser the certificate is issued by localhost in case of a certificate error.
Caddy Logs show it has succesfully generated new certificates for the domain and wildcard subdomain.
Bad Gateway usually happens when I try to generate the certificate on my reverse proxy already, while a straight passthrough gives me the cert error. Probably because it's forwarding using http instead?
Hope somebody has an Idea.
68 Replies
what port is coder listening to ?
I think you should just proxy coder via http and let caddy handle the certs
Coder is listening to 3000 iirc, from the coder docs, then caddy maps it to 443.
I did try to proxy via http only, but then I get an invalid Certificate, despite Caddy logs saying it got the requested certificates.
can you show me your caddy conf
http or https ?
This is the caddy file:
`
Just removed the token and domains
Now that's a good question, I'd have to check but iirc it is https. In my first test server I blocked all traffic despite 22 and 443 and it worked just fine. So I'm kind of at a loss here
here's your issue then
this config scares me
I don't think it can work
It's with caddy DNS Challenge, it works just like that on my other dev system
this would work
but the
file_server
is likely what's breaking it allhm, that's from the coder docs and what is also working on the other system. But I'll try commenting that out
can you link me to that docs page ?
cause I don't see a way this is working
in that case I think the
file_server
directive takes over your reverse_proxy
oneIt's linked here: https://coder.com/docs/coder-oss/latest/admin/configure#system-packages
to: https://github.com/coder/coder/tree/main/examples/web-server/caddy
GitHub
coder/examples/web-server/caddy at main · coder/coder
A tool that provisions remote development environments via Terraform - coder/examples/web-server/caddy at main · coder/coder
Configuration - Coder OSS main docs
Learn how to configure Coder
😶
![No description](https://cdn.answeroverflow.com/1055393132151324692/image.png)
oh no wait, it's not, lol
i think you just pasted it into your example caddy host
Guess it's residue from the base caddyfile then 🫠
for the record here's mine
btw, if you're using a fresh domain and it won't fetch the certs then
resolvers 1.1.1.1
is a nice tip
they update almost instantly