Skip to content

Commit

Permalink
fix(#72): disable http caching of index.html
Browse files Browse the repository at this point in the history
set response headers to:
HTTP/1.1 200 OK
Expires: Fri, May 11 2018 10:48:51 GMT
Cache-Control: max-age=0, no-cache, no-store
Pragma: no-cache
  • Loading branch information
m-tartari authored and EdoardoRomiti committed Sep 30, 2024
1 parent 6edf6c6 commit d7a41c8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/modular/web/RobotDesignStudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import numpy as np

import rospy
from flask import Flask, Response, render_template, request, jsonify, send_from_directory, abort, session, send_file
from flask import Flask, Response, make_response, render_template, request, jsonify, send_from_directory, abort, session, send_file
from apscheduler.schedulers.background import BackgroundScheduler
import werkzeug

Expand Down Expand Up @@ -192,7 +192,14 @@ def index():
last_updated= datetime.now(),
)

return render_template('index.html')
# for the index page we want to disable caching
index_page = make_response(render_template('index.html'))
# exparies in the past (date of the first commit of the project)
index_page.headers['Expires'] = 'Fri, May 11 2018 10:48:51 GMT'
index_page.headers['Cache-Control'] = 'max-age=0, no-cache, no-store'
index_page.headers['Pragma'] = 'no-cache'
return index_page


# Get workspace mode
@app.route(f'{api_base_route}/mode', methods=['GET'])
Expand Down

0 comments on commit d7a41c8

Please sign in to comment.