Difference between http://cloud.com/ and http://cloud.com

1. The problem I’m having:

I have these two Caddyfiles:

1 - http://cloud.com/ {
reverse_proxy localhost:6101
}

2 - http://cloud.com {
reverse_proxy localhost:6101
}

localhost:6101 - this is .net core application with angular files in it
When i use first Caddyfile - requests doesn’t proxy to localhost:6101 at all, i get 200 with every request.
When i use second Caddyfile - requests works allright.

2. Error messages and/or full log output:

There are no errors in log

3. Caddy version:

  1. v2.7.4 h1:J8nisjdOxnYHXlorUKXY75Gr6iBfudfoGhrJ8t7/flI=

4. How I installed and ran Caddy:

sudo caddy run

a. System environment:

ubuntu

b. Command:

sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
sudo caddy run

d. My complete Caddy config:

http://cloud.com {
reverse_proxy localhost:6101
}

One has a path, the other doesn’t.

If you specify a path in a site address, it’s a path matcher and only matches requests to those domains.

So if you make a request to http://cloud.com/ then it will work. But if you make a request to http://cloud.com/foo.html, then it won’t match because / != /foo.html.

To match all paths, omit the matcher entirely (omit the /), or specify a specific path or path prefix you want to match, like /foo/* etc.

This syntax is useful if you have multiple sites served in sub-paths.

Though it’s deprecated, and will become an error in a future version, because it’s misleading and confusing (as evidenced by this question).

1 Like

Before we do that though, can we try documenting this better first? I still think it makes sense but people just aren’t aware of it. That’s my bad. I can work on those docs.

(Clearly the deprecation warning isn’t being noticed either – so while an error would force them to recognize it, I still feel like it has some utility…)

Thanks a lot, it makes sense

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.