Question about reverse proxy Caddyfile syntax variations

Consider the following scenario:
app1 - 192.168.1.205:10001
app2 - 192.168.1.205:10002
app3 - 192.168.1.205:10003

Have DDNS set up with the following domains:
app1.mydomain.com
app2.mydomain.com
app3.mydomain.com

I’ve seen the syntax written a few different ways. Here is one variation:

app1.mydomain.com {
reverse_proxy 192.168.1.205:10001
}
app2.mydomain.com {
reverse_proxy 192.168.1.205:10002
}
app3.mydomain.com {
reverse_proxy 192.168.1.205:10003
}

Then I was reading an article on the wiki here, which has a whole different take on it.

example.com

reverse_proxy /service-a/* 192.168.0.2:8001
reverse_proxy /service-b/* 192.168.0.2:8002

What’s the difference, and does it matter in my use case?

I believe the former refers to domain-based networks, which uses subdomains e.g. service-a.mydomain.com, while the latter refers to a path-based network, which uses subdirectories e.g. mydomain.com/service-a.

1 Like

See the reverse_proxy docs here:

The difference is the later uses a path matcher:

Also see the Caddyfile Concepts docs page which describes the difference in terms of structure (multiple sites in the first, vs one site in the second):

1 Like

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