Continuing the discussion from Using Caddy as a reverse proxy in a home network:
Hi,
I use Caddy to serve my basic website on a mini cloud server (CentOS 7, using the Caddy repos), and btw it’s great! But also while I have an understanding of roughly how these things work, I’m definitely more noob than pro.
I am starting to run some services on a home server (which would be some simple web apps as I learn, hopefully a Nextcould, and maybe parts of my website), but ideally I don’t want these pointing directly at my home ip address, because I do understand that this probably isn’t the most ideal thing to do, and there are benefits to having a static front-end ip.
So my question is: What ways can I use Caddy and the cloud server to be the front end and hide my home ip address?
-
Don’t worry and just use my local IP and only port forward to Caddy.
-
I assume bad - reverse proxy from cloud server Caddy to ports directly forwarded to the services.
Here I am hiding my home IP, but have to have a number of open ports. -
Is this possible? - reverse proxy with some config from the cloud server Caddy to a single port that forwards to a home Caddy, which splits the traffic out to the services.
-
You have a better idea!
From some experimentation (my server wasn’t expecting to be asked to return e.g. someservice.sambr.co.uk so I had to change the Host header to the local address it expected using header_up http:192.168.0.99:9999
in the reverse proxy directive) I realised that the Host header is not edited - so can you just reverse proxy one Caddy to another and extract the right url information?
Something like:
First Caddyfile on the cloud server
service.sambr.co.uk {
reverse_proxy {
to https://99.99.99.99 --- e.g. ip of my home
}
}
Second Caddyfile on home server
service.sambr.co.uk {
reverse_proxy {
to http://192.168.0.99:9999 --- ip of the particular service on home network
header_up Host http://192.168.0.99:9999
}
}
I think this won’t work and auto https will fail - but is there a way to do this, ideally through one non-standard port, and be able to split the sub-domains and keep uri paths correct?
Thanks,
Sam