1. Caddy version (caddy version
):
2.0.0
2. How I run Caddy:
caddy run
with a Caddyfile in the pwd (/home/hari/public)
a. System environment:
vanilla centos 7
d. My complete Caddyfile or JSON config:
http://mysite.com {
bind mysite.com
file_server /files {
browse
root /home/hari/public
}
log {
output file /opt/logs/caddy.log
}
}
“mysite.com” resolves to the correct IP of the machine. I am not being a load balancer or some AWS internal VPC or whatever where the external IP of the machine doesn’t match the address of ifconfg or ip a
3. The problem I’m having:
I want to be able to go to http://mysite.com/files and be shown the file server. I want to be able to go to http://mysite.com/some_service and be reverse proxied to something (we will get to that later)
I have tried different combinations, but I either get a blank screen or a 404
5. What I already tried:
I have tried starting my block with http://mysite.com/files
, but that didn’t work either. I tried putting the root directive with a /files matcher outside, didn’t work. I tried putting root .
inside the file_server, (apparently, inside the file server there is no matcher?) that doesn’t work either.
I even tried this, seperately I ran this
caddy file-server --listen 127.0.0.1:8000 --browse
and then had this in my config file
http://mysite.com {
bind mysite.com
reverse_proxy /files 127.0.0.1:8000
}
but I am still seeing only blank pages
Finally, I tried the following 2 commands
caddy file-server --listen 127.0.0.1:8000 --browse
caddy reverse-proxy --from http://mysite.com/files --to 127.0.0.1:8000
And I see this
reverse-proxy: paths are not allowed: http://mysite.com/files
huh?
TL;DR … I want http://mysite.com/files to go to a file handler pointing to some path (/home/hari/public), and I want http://mysite.com/<some_service> to go to some other service
Thoughts? am I missing something basic here?