How to stop Starlette from setting "Cache-Control: no-cache"?

50 Views Asked by At

I have a uvicorn / starlette app set up with:

from starlette.applications import Starlette
from starlette.routing import Route
from starlette.middleware import Middleware
from starlette.middleware.cors import CORSMiddleware
from starlette.staticfiles import StaticFiles
from starlette.routing import Mount

DIST_DIR = "dist"

routes = [
    Mount('/', app=StaticFiles(directory=DIST_DIR), name="static"),
]

middleware = [
    Middleware(CORSMiddleware, allow_origins=['*'], allow_methods=['*'], allow_headers=['*'])
]

app = Starlette(debug=True, routes=routes, middleware=middleware)

All files served from starlette have Cache-Control: no-cache and Pragma: no-cache headers set.

As I use tihs app to serve an Office add-in, this is causing problems because the icon is not displayed in the desktop version of the app (see the comments to this question for context).

How can I configure starlette to not send a Cache-Control: no-cache header?

0

There are 0 best solutions below