# HttpApiDispatcher Swagger base path issue with Ingress Controller

**URL:** https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119
**Category:** Remoting SDK
**Created:** [March 24, 2023, 1:24pm UTC](https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119 "2023-03-24T13:24:44Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Tim\_Mayer](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Tim\_Mayer](https://talk.remobjects.com/u/Tim_Mayer)
#### Post date: [March 24, 2023, 1:24pm UTC](https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119/1 "2023-03-24T13:24:44Z")

</div>

We have an API exposed and it produces a swagger document similar to below using the following URL:

```
http://<server>/api

```

Produces:

> {  
> “swagger”: “2.0”,  
> “info”: {  
> “version”: “1.0.0”,  
> “title”: “CEPAVendorSpecificInterface”  
> },  
> **“basePath”: “/api”,**  
> “consumes”: [  
> “application/json”  
> ],  
> …

This works fine when running locally, but we’re deploying it to a server using Kubernetes and Ingress, in which case the URL becomes:

```
https://<server>/cepavsi/api

```

This returns the exact same swagger document, and our automated test software fails our tests with the error “Swagger Compliance Assertion”.

So ideally the basepath could be change to reflect the new URL. To do this, I tried the following:

```
server.ApiDispatcher.Path = "/cepavsi/api/";

```

But then the URL for accessing the server, because of Ingress, duplicates **cepavsi** and becomes:

```
https://localhost/cepavsi/cepavsi/api/

```

Which returns the following:

> {  
> “swagger”: “2.0”,  
> “info”: {  
> “version”: “1.0.0”,  
> “title”: “CEPAVendorSpecificInterface”  
> },  
> **“basePath”: “/cepavsi/api”,**  
> “consumes”: [  
> “application/json”  
> ],  
> …

Is there a way to change the Swagger document to match the “basePath” exposed by the Ingress controller as “/cepavsi/api” but still serve “/api”?

Tim

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [March 24, 2023, 1:32pm UTC](https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119/2 "2023-03-24T13:32:57Z")

</div>

Hi,

Can you specify platform (.NET or Delphi) are you using, pls?

---

<div class="post-metadata">

### Author: ![Tim\_Mayer](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Tim\_Mayer](https://talk.remobjects.com/u/Tim_Mayer)
#### Post date: [March 24, 2023, 2:21pm UTC](https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119/3 "2023-03-24T14:21:40Z")

</div>

Hi Evgeny,

This is .NET.

Tim

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [March 27, 2023, 7:58am UTC](https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119/4 "2023-03-27T07:58:28Z")

</div>

Hi,

> [@Tim\_Mayer](#):
>
> Is there a way to change the Swagger document to match the “basePath” exposed by the Ingress controller as “/cepavsi/api” but still serve “/api”?

You can create descendant of [HttpApiDispatcher](https://docs.remotingsdk.com/API/NET/Classes/HttpApiDispatcher/) and override metadata request where you can change `basePath`.

example is attached  
[testcase.zip](https://talk.remobjects.com/uploads/short-url/qjVjjKDZc7FLIzw3YIRyziOZf7D.zip) (59.1 KB)

---

<div class="post-metadata">

### Author: ![Tim\_Mayer](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Tim\_Mayer](https://talk.remobjects.com/u/Tim_Mayer)
#### Post date: [March 27, 2023, 1:38pm UTC](https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119/5 "2023-03-27T13:38:28Z")

</div>

Thanks Evgeny.

I’ll give that a try this morning.

Tim

---

<div class="post-metadata">

### Author: ![Tim\_Mayer](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@Tim\_Mayer](https://talk.remobjects.com/u/Tim_Mayer)
#### Post date: [March 28, 2023, 3:43pm UTC](https://talk.remobjects.com/t/httpapidispatcher-swagger-base-path-issue-with-ingress-controller/28119/6 "2023-03-28T15:43:19Z")

</div>

Thanks Evgeny.

I tried it this morning, and can confirm that this technique works for our C# .NET API service. Our ReadyAPI tests now successfully validate the Swagger document.

Tim
