# Multiple basepaths

**URL:** <https://discuss.google.dev/t/multiple-basepaths/10925>\
**Category:** Apigee\
**Tags:** api-runtime\
**Created:** [April 29, 2021, 5:09pm UTC](https://discuss.google.dev/t/multiple-basepaths/10925 "2021-04-29T17:09:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [April 29, 2021, 5:09pm UTC](https://discuss.google.dev/t/multiple-basepaths/10925/1 "2021-04-29T17:09:42Z")

</div>

Is there a way for an apiproxy to handle multiple basepaths?

We currently have a hard-coded API prefix on all our proxies as follows:

```auto
<ProxyEndpoint name="default">
  ...
  <HTTPProxyConnection>
    <BasePath>/api/prefix/*/service</BasePath>
    <VirtualHost>secure</VirtualHost>
  </HTTPProxyConnection>
  ...
</ProxyEndpoint> 

```

We’d like to remove the API prefix without breaking backwards-compatibility with the clients. For example:

```auto
<ProxyEndpoint name="default">
  ...
  <HTTPProxyConnection>
    <BasePath>/api/prefix/*/service</BasePath>
    <BasePath>/service</BasePath>
    <VirtualHost>secure</VirtualHost>
  </HTTPProxyConnection>
  ...
</ProxyEndpoint> 

```

Once all the clients have upgraded then we can remove the old BasePath and everyone’s happy. With mobile clients, this can take several months.

I want to **avoid duplicating** any code.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [April 29, 2021, 5:32pm UTC](https://discuss.google.dev/t/multiple-basepaths/10925/2 "2021-04-29T17:32:10Z")

</div>

Yes proxy can handle multiple basepath.

u can create multiple ProxyEndpoint and and defined the basepath :

 ![10974-multiplebasepath.png](https://d2yds90mtvelsl.cloudfront.net/original/2X/3/3f35bc0324bcc880e6ef4368ee735ab9dc04b27d.png)

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [April 29, 2021, 7:57pm UTC](https://discuss.google.dev/t/multiple-basepaths/10925/3 "2021-04-29T19:57:09Z")

</div>

How do I do that without duplicating the code in `default`, for example?

In my case, default.xml may contain dozens of Flows, RoutingRules etc

---

<div class="post-metadata">

**Author:** ![dchiesa1](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/dchiesa1/32/15641_2.png) [@dchiesa1](https://discuss.google.dev/u/dchiesa1)\
**Post date:** [April 29, 2021, 10:27pm UTC](https://discuss.google.dev/t/multiple-basepaths/10925/4 "2021-04-29T22:27:33Z")

</div>

One way to do that would be to delegate to an “internal” proxy from proxy endpoints listening on each basepath.

This article explains the [internal proxy concept](https://community.apigee.com/articles/26525/securing-your-internal-apis-with-apigee-edge.html).You could use a LocalTargetConnection between the outward-facing proxy endpoints and the private one.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [April 30, 2021, 4:21am UTC](https://discuss.google.dev/t/multiple-basepaths/10925/5 "2021-04-30T04:21:22Z")

</div>

There is an option in proxy to save as new proxy, you can just change the basepath, save as new proxy and save the proxy with extension V2.

---

<div class="post-metadata">

**Author:** ![venkatvenkatsiv](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/venkatvenkatsiv/32/1102_2.png) [@venkatvenkatsiv](https://discuss.google.dev/u/venkatvenkatsiv)\
**Post date:** [April 30, 2021, 11:21am UTC](https://discuss.google.dev/t/multiple-basepaths/10925/6 "2021-04-30T11:21:34Z")

</div>

You will have different revisions of your api proxy know. You can deploy one revision with the base path _/api/prefix/\*/service_.

And deploy another/next revision with the another base path _/service_.

It is allowed and I have worked with this approach in lower environments. It was helpful to me as I was maintaining the basepath /v1 as standard code(and provided to front-end people for testing and working from their end) and the basepath /v2 as working code.

Here, you have duplicate of code though. So kindly decide for your-self.
