Added note for working with virtual directories (#9128)
I spent a day or more researching this so that I could use Swagger-UI in my ASP.NET Core API which is used with a reverse-proxy and virtual directory. In the end found Swagger-UI requires relative URLs to start with a period. Related to https://github.com/swagger-api/swagger-ui/issues/4107 Hoping this documentation note will help others. When creating a new PR, please do the following and delete this template text: * Reference the issue number if there is one: Fixes #Issue_Number > The "Fixes #nnn" syntax in the PR description causes > GitHub to automatically close the issue when this PR is merged.pull/9588/head
parent
73fda161c8
commit
0d1834264f
|
@ -4,7 +4,7 @@ author: zuckerthoben
|
|||
description: Learn how to add Swashbuckle to your ASP.NET Core web API project to integrate the Swagger UI.
|
||||
ms.author: scaddie
|
||||
ms.custom: mvc
|
||||
ms.date: 11/05/2018
|
||||
ms.date: 11/14/2018
|
||||
uid: tutorials/get-started-with-swashbuckle
|
||||
---
|
||||
# Get started with Swashbuckle and ASP.NET Core
|
||||
|
@ -102,6 +102,8 @@ The Swagger UI can be found at `http://localhost:<port>/swagger`. Explore the AP
|
|||
>
|
||||
> [!code-csharp[](../tutorials/web-api-help-pages-using-swagger/samples/2.0/TodoApi.Swashbuckle/Startup3.cs?name=snippet_UseSwaggerUI&highlight=4)]
|
||||
|
||||
If using virtual directories (with IIS or a reverse proxy, for example), set the Swagger endpoint to a relative path using the `./` prefix. For example, `./swagger/v1/swagger.json`. Using `/swagger/v1/swagger.json` instructs the app to look for the JSON file at the true root of the URL (plus the route prefix, if used). For example, `http://localhost:<port>/<route_prefix>/swagger/v1/swagger.json` instead of `http://localhost:<port>/<virtual_directory>/<route_prefix>/swagger/v1/swagger.json`.
|
||||
|
||||
## Customize and extend
|
||||
|
||||
Swagger provides options for documenting the object model and customizing the UI to match your theme.
|
||||
|
|
Loading…
Reference in New Issue