RicoSuter/NSwag

Disable caching of swagger.json

Open

#1,151 opened on Jan 24, 2018

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

Repository metrics

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

Description

While deploying our code to a test environment, we were getting what looked like CORS issues. After digging into it more, the swagger.json file had the host value set to localhost even though we were accessing it through a DNS entry.

After playing with it some more, we determined that the swagger.json file is cached on the server and however it is accessed first is how it will be returned until the app pool recycles. In our case, after we deployed the code on the server, someone brought up the swagger UI using localhost first.

Is it possible to turn this caching off so that the Host value dynamically changes?

Contributor guide