title: Swagger: change api route in Swagger UI
body: <p>I have two kubernetes services deployed on a AKS, they receive traffic from a Nginx Ingress Controller. The endpoints for these two services are <code>https:&lt;dns&gt;/service1</code>and <code>https:&lt;dns&gt;/service2</code>. Now I want to set up Swagger for each services. Below is how I set up Swagger UI for one of the services.</p>
  
  <pre><code>app.UseSwaggerUI(c =&gt;
          {
              c.SwaggerEndpoint("/service1/swagger/v1/swagger.json", "API V1");
          });
  </code></pre>
  
  <p>With this configuration, I can get access to swagger by <code>https:&lt;dns&gt;/service1/swagger</code>.</p>
  
  <p>Now the problem is, in Swagger UI, when I want to test the api by clicking the "Try it out" button then Excute button, the url that Swagger UI access is  <code>https:&lt;dns&gt;/api/v1/contoller</code> instead of <code>https:&lt;dns&gt;/service1/api/v1/contoller</code>. Which means that Swagger UI is not aware of the existance of path <code>/service1/</code>. I found several related questions like this one <a href="https://stackoverflow.com/questions/39116047/how-to-change-base-url-of-swagger-in-asp-net-core">How to change base url of Swagger in ASP.NET core
  </a>. But they are not the solution for my problem. My guess is I need to set a base path for Swagger. If anyone could tell me how to configure base path for Swagger in ASP.NET core 2.0, it would be much appreciated.</p>