I created the first handle_path and it worked, API A received the requests made to /apia/v1
, as expected.
However, I have two APIs, A and B, and I need to route the messages that arrive at /apia*
to the service running on port 3001 and the requests that arrive at /apib*
to the service running on port 3002.
But when I added the second service, all requests are going to it. Below is what I tried but it didn't work.
What did I do wrong?
:8000 {
handle_path /apia* {
rewrite * /apia{uri}
reverse_proxy localhost:3001
}
handle_path /apib* {
rewrite * /apib{uri}
reverse_proxy localhost:3002
}
}
EDIT: My second try, same result.
localhost
reverse_proxy /apia/* localhost:3001
reverse_proxy /apib/* localhost:3002