I was writing a REST API with ASP.NET Core 2.1 and the Swashbuckle Nuget package using the Microsoft docs and everything was working well locally. Then I deployed it to the cloud where we had a reverse proxy routing requests with virtual paths prefixes and the Swagger-UI couldn’t find the swagger.json file.
After much research found a similar issue on Github where lemartin pointed out Swagger-UI requires relative paths to be prefixed with a period. For example,
app.UseSwaggerUI(c => c.SwaggerEndpoint($”./{version}/swagger.json”,
Hope this is helpful to others as well. If so, you can vote up a PR I submitted to the Microsoft docs to repo to improve the Get started with Swashbuckle and ASP.NET Core tutorial.