stac-utils / titiler-pgstac

TiTiler + PgSTAC
https://stac-utils.github.io/titiler-pgstac/
MIT License
80 stars 29 forks source link

Disable caching for /searches/list #174

Closed drnextgis closed 2 months ago

drnextgis commented 2 months ago

When I first ran /searches/list?limit=10&offset=0, it understandably returned 0 because the corresponding table was empty. However, after registering a mosaic, it continued to return 0 until I either modified some of the GET parameters or removed them entirely. This was quite confusing until I realized that the browser had cached the initial response. Do you think it makes sense to disable caching headers for that endpoint?

vincentsarago commented 2 months ago

Do you think it makes sense to disable caching headers for that endpoint?

Yes, we can add the exclude_path settings for the CacheControlMiddleware https://github.com/developmentseed/titiler/blob/main/src/titiler/core/titiler/core/middleware.py#L23

https://github.com/stac-utils/titiler-pgstac/blob/main/titiler/pgstac/main.py#L104

example: https://github.com/developmentseed/titiler/blob/main/src/titiler/core/tests/test_cache_middleware.py#L49-L54