1. Caddy version:
v2.6.4 on Ubuntu
2. How I installed, and run Caddy:
Using the script within the help Caddy documentation. Direct installation within the OS. The linux server is not doing anything else and will only be a reverse proxy.
a. System environment:
Ubuntu 22 (Ubuntu 22.04.2 LTS)
b. Command:
THIS WORKS:
caddy reverse-proxy --from :2015 --to http://192.168.0.157:80
THIS DOES NOT WORK:
caddy reverse-proxy --from http://gci.localhost:2015 --to http://192.168.0.157:80
c. Service/unit/compose file:
n/a
d. My complete Caddy config:
not using a caddy file
3. The problem I’m having:
I am trying to get a reverse proxy to work.
I have two servers:
192.168.0.157 - simple apache server which will server a webpage on http port 80
192.168.0.167 - caddy which I want to be a reverse proxy and redirect traffic based or servername
When I run the command ‘caddy reverse-proxy --from :2015 --to http://192.168.0.157:80’ it will work fine. When accessing http://192.168.0.167:2015 I get the webpage from http://192.168.0.157:80
I have changed my hosts.ini to direct all traffic from gci.localhost to 192.168.0.167. A ping confirms this.
The caddy command ‘caddy reverse-proxy --from gci.localhost --to http://192.168.0.157:80’ does not work. I have tried various combinations and cannot get http://gci.localhost to work and show me the webpage from http://192.168.0.157:80
4. Error messages and/or full log output:
root@caddy:/# caddy reverse-proxy --from http://gci.localhost:2015 --to http://192.168.0.157:80
2023/02/23 09:09:20.849 WARN admin admin endpoint disabled
2023/02/23 09:09:20.850 WARN http automatic HTTPS is completely disabled for server {“server_name”: “proxy”}
2023/02/23 09:09:20.852 INFO http.log server running {“name”: “proxy”, “protocols”: [“h1”, “h2”, “h3”]}
Caddy proxying http://gci.localhost:2015 → 192.168.0.157:80
2023/02/23 09:09:20.853 INFO tls cleaning storage unit {“description”: “FileStorage:/root/.local/share/caddy”}
2023/02/23 09:09:20.854 INFO tls finished cleaning storage units
2023/02/23 09:09:20.855 INFO tls.cache.maintenance started background certificate maintenance {“cache”: “0xc0000d8f50”}
5. What I already tried:
I have tried all manner of combinations. I cannot get a hostname to ever be proxied by caddy.