SwaggerUI combo for api definitions is cached / not refreshed #3709
-
|
I have a service that follows this blog post to add versioning to my rest api: the controllers are placed in directories "v1" and "v2", and SwaggerUI should display the different versions in the "Select a definition" combo in the upper right corner. This did not seem to work for me - a new version did not appear in the combo. After hours of searching, I found that it is an issue of browser caching (happens at least with firefox) - a simple "Ctrl+F5" would have saved me a lot of time. Attached is an updated version of the blog post sample from https://github.com/gavilanch/ASPNETCoreSwaggerVersioning (updated to recent Swashbuckle versions): To reproduce:
If found #3336 which is about cache headers for SwaggerUI, but it does not seem to affect my sample. Is there anything that can be done in my app about this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 12 replies
-
|
From a quick look at the code, not without adding some custom code to try and manually set the cache headers on the response for the index page and/or endpoint resource to cache-bust it. We should probably build-in similar caching for the endpoint URLs response as we do for all the static files: #3710 |
Beta Was this translation helpful? Give feedback.




Thanks. Turns out this wasn't anything to do with the document URLs endpoint as they were just rendered in the JavaScript for the UI page, but the caching behaviour had various bugs in it. #3772 should fix it.