Hi All,
We have an environment group with multiple aliases (e.g., api-dev.com , ds.api-dev.com , dp-api-dev.com and so on ... ).
Requirement 1: Retail API Access Control:
The Retail API must only be accessible via api-dev.com .
Requests hitting the Retail API via other aliases (e.g., ds.api-dev.com ) should be rejected.
Requirement 2: Book API Access Control:
The Book API must only be accessible via dsc.api-dev.com .
Requests hitting the Book API via other aliases should be rejected.
Desired Solution: We want to implement this routing logic within the Apigee X pre-hook flow (before any proxy logic).
Current Thinking: Using a JavaScript policy in the pre-flow to inspect the Host header and conditionally route/reject requests. Followed by RaiseFault Policy to reject the request, here this possibility that individual api level, I want to apply this condition pre-hook level so that it applicable to all the apis, based on hostname it should route and others should be rejected.
In Apigee Edge, we have the concept of Virtual Hosts; however, in Apigee X, this concept does not exist. Instead, we have the organization concept. However, we do not want to create a separate organization for each host.
Are there alternative/more efficient ways to achieve this hostname-based routing in the pre-hook-flow?
Are there any built-in Apigee X policies or features that could simplify this?