Different VirtualHosts for different API endpoints

Not applicable

Hi guys,

I have a proxy, which has a set of endpoints, e.g. /cats and /dogs.

And I need to provide access to only /cats using one virtual host and for /cats and /dogs using another virtual host.

Is it possible to implement this without creating two separate proxies?

0 2 93
2 REPLIES 2

sidd-harth
Participant V

Hi @arsenalrulez, yes it can be done. Lets say we have 2 virtual hosts default & secure

  1. Deploy the proxy to both virtual hosts.
  2. When we make a call the virtual host details are available as flow variables & can be seen in Request Trace session.
  3. We can use conditions for both endpoints like,
<Condition>(proxy.pathsuffix MatchesPath "/cats") and (request.verb = "GET") and (virtualhost.name = "default")</Condition>

<Condition>(proxy.pathsuffix MatchesPath "/dogs") and (request.verb = "GET") and (virtualhost.name = "secure")</Condition>