Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
debug_router,
download_router,
health_router,
insights_router,
libraries_router,
og_images_router,
plots_router,
Expand Down Expand Up @@ -128,6 +129,9 @@ async def add_cache_headers(request: Request, call_next):
# Individual spec details (5 min cache, 1h stale-while-revalidate)
elif path.startswith("/specs/"):
response.headers["Cache-Control"] = "public, max-age=300, stale-while-revalidate=3600"
# Insights endpoints (5 min cache, 1h stale-while-revalidate)
elif path.startswith("/insights/"):
response.headers["Cache-Control"] = "public, max-age=300, stale-while-revalidate=3600"

return response

Expand All @@ -141,6 +145,7 @@ async def add_cache_headers(request: Request, call_next):
app.include_router(specs_router)
app.include_router(libraries_router)
app.include_router(plots_router)
app.include_router(insights_router)
app.include_router(download_router)
app.include_router(seo_router)
app.include_router(og_images_router)
Expand Down
2 changes: 2 additions & 0 deletions api/routers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from api.routers.debug import router as debug_router
from api.routers.download import router as download_router
from api.routers.health import router as health_router
from api.routers.insights import router as insights_router
from api.routers.libraries import router as libraries_router
from api.routers.og_images import router as og_images_router
from api.routers.plots import router as plots_router
Expand All @@ -16,6 +17,7 @@
"debug_router",
"download_router",
"health_router",
"insights_router",
"libraries_router",
"og_images_router",
"plots_router",
Expand Down
Loading
Loading