Skip to content

Commit

Permalink
Fix issue #4127: '[Bug]: Disable cache on web application'"'"'s index…
Browse files Browse the repository at this point in the history
….html'
  • Loading branch information
openhands-agent committed Sep 30, 2024
1 parent 71adfee commit d86f7a7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions openhands/server/listen.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,4 +753,16 @@ async def security_api(request: Request):
)


@app.get("/", response_class=FileResponse)
async def read_root():
response = FileResponse("./frontend/dist/index.html")
response.headers["Cache-Control"] = "no-store, max-age=0"
return response

@app.get("/index.html", response_class=FileResponse)
async def read_index():
response = FileResponse("./frontend/dist/index.html")
response.headers["Cache-Control"] = "no-store, max-age=0"
return response

app.mount('/', StaticFiles(directory='./frontend/dist', html=True), name='dist')

0 comments on commit d86f7a7

Please sign in to comment.