RicoSuter/NSwag

NSwag and Service Fabric

Open

#1,220 opened on Mar 13, 2018

View on GitHub
 (15 comments) (0 reactions) (0 assignees)C# (1,189 forks)batch import
help wantedtype: question

Repository metrics

Stars
 (6,291 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

I'm trying to move from Swagger/Swatchbuckle to NSwag but im running into issues trying to access swagger ui.

Since im using Service Fabric, all my apis are behind a reverse proxy. Accessing the direct url:

http://localhost:60841/8f0077aa-6088-469d-9465-449acce86123/131654410884013502/swagger/

works, but accessing the reverse url:

http://localhost:19081/MyApp/MyService/swagger/

does not. It gets redirected to the direct url

http://localhost:19081/c94a3b54-f097-4cbe-bc82-d1e70a403134/131655768288075951/swagger/index.html?url=/c94a3b54-f097-4cbe-bc82-d1e70a403134/131655768288075951/swagger/v1/swagger.json

and reports a 404.

Accessing the reverse url did work when I was using swatchbuckle but then I also had this configuration:

app.UseSwagger(c =>
{
   c.PreSerializeFilters.Add((swaggerDoc, httpReq) => swaggerDoc.BasePath = "/MyApp/MyService");
});

Does NSwag have a option to set PreSerializeFilters? Is there another option that I can use to get the ui to work behind a reverse proxy?

Contributor guide