xoron
(xoron)
April 11, 2018, 11:40am
1
i am new to using caddy and i am trying to figure out how to create a subdomain that can proxy to different endpoints based on path.
for example for a subdomain called pets
in the domain my-website.com
. i want to route the path /cats
to serviceA
and /dogs
to serviceB
.
i have tried this configuration:
pets.my-website.com {
proxy /cats http://serviceA:80
proxy /dogs http://serviceB:80
}
but this does not seem to work.
can anyone see what i am doing wrong?
pwhodges
(Paul Hodges)
April 11, 2018, 1:21pm
2
You don’t say what you mean by “doesn’t work”. Could it be simply that you haven’t removed the “cats” or “dogs” from the URL you pass on? As in:
proxy /cats http://serviceA {
without /cats
}
proxy /dogs http://serviceB {
without /dogs
}
1 Like
xoron
(xoron)
April 11, 2018, 2:11pm
3
by “doesn’t work” i meant that the redirect doesn’t behave how i expect (i.e. redirect to the proxied endpoint).
i assumed it automatically removed “/cats” or “/dogs” from the URL by default. i have tried your method and now it works!
thanks!
system
(system)
Closed
July 10, 2018, 2:11pm
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.