mmkk18
mmkk18

Reputation: 93

Configure multiple base paths in APIGEE

I wanted to know if we can configure multiple base path for a proxy endpoint in APIGEE. The target proxy remains same for both basepaths.

Example: I want to ensure /hello/world and /hello/universe route to same target endpoint and are treated in same way entirely

    <HTTPProxyConnection>
        <BasePath>world</BasePath>
        <BasePath>universe</BasePath>
        <VirtualHost>hello</VirtualHost>
    </HTTPProxyConnection>

How to achieve the same?

Upvotes: 1

Views: 2044

Answers (1)

evansche
evansche

Reputation: 371

The <VirtualHost> field should refer to an Apigee vhost, which is a Fully Qualified Domain Name ('FQDN'). That's a hostname like demo.api.company.com. E.g., everything before the first /.

Your proxy basepath is then /hello, like this:

<BasePath>hello</BasePath>

And then the rest of your API proxy definition uses flows and path-matching conditions to handle the different methods you want to operate at /hello/world vs /hello/universe

<Flow name="world_GET">
            <Description>World GET</Description>
            <Request>
                <Step>
                    <Name>World01</Name>
                </Step>
                <Step>
                    <Name>World02</Name>
                </Step>
            </Request>
            <Response/>
            <Condition>((proxy.pathsuffix MatchesPath "/world") and (request.verb = "GET"))</Condition>
        </Flow>
        <Flow name="universe_GET">
            <Description>Uni GET</Description>
            <Request>
                <Step>
                    <Name>Uni01</Name>
                </Step>
                <Step>
                    <Name>Uni02</Name>
                </Step>
            </Request>
            <Response/>
            <Condition>((proxy.pathsuffix MatchesPath "/universe") and (request.verb = "GET"))</Condition>
        </Flow>

See: https://docs.apigee.com/api-platform/reference/api-proxy-configuration-reference#proxyendpoint-proxyendpointconfigurationelements

Upvotes: 0

Related Questions