title: Asp.Net Core: Swagger-UI requests not working (are not relative)
body: <p>Hy</p>
  
  <p>We're using Asp.Net Core to create a REST-Service with Swagger. We're hosting the service at a URL like this:</p>
  
  <p><a href="https://www.mywebsite.com/myservice" rel="nofollow noreferrer">https://www.mywebsite.com/myservice</a></p>
  
  <p>With the following code:</p>
  
  <pre><code>    applicationBuilder
          .UseSwagger()
          .UseSwaggerUI(c =&gt;
          {
              c.SwaggerEndpoint("../swagger/1.0.0/swagger.json"",title);
              c.DisplayRequestDuration();
              c.OAuthClientId(clientId);
              c.OAuthRealm(redirectUri);
              c.OAuthAppName("App");
          });
  </code></pre>
  
  <p>...the Swagger-UI is correctly loading at:</p>
  
  <p><a href="https://www.mywebsite.com/myservice/swagger/" rel="nofollow noreferrer">https://www.mywebsite.com/myservice/swagger/</a></p>
  
  <p>But when I try to do a Request over the UI with the Execute-Button, I got a 404, because the UI tries to do the request without the /myservice/ in the URL:</p>
  
  <p><a href="https://www.mywebsite.com/v1/cars" rel="nofollow noreferrer">https://www.mywebsite.com/v1/cars</a></p>
  
  <p>instead of</p>
  
  <p><a href="https://www.mywebsite.com/myservice/v1/cars" rel="nofollow noreferrer">https://www.mywebsite.com/myservice/v1/cars</a></p>
  
  <p>How do I have to correctly configure the service, so that the Swagger UI Calls are also working?</p>
  
  <p>Hint:</p>
  
  <p>This should be done in a generic way (like the ../ of the UI), because we will deploy the service on different environments, so the www.mywebsite.com is not the same on each environment.</p>
  
  <p>Thanks for your help!</p>
  
  <p>Regards,</p>
  
  <p>Peter</p>