I have a Flask App that has multiple APIs, one of the APIs I've is accessed using POST request and takes data in the body along with some headers, for example, student_id. This API returns the student results based on the passed student_id in the headers.
I've run it in pycharm IDE (locally) and it works 100%, in which for each different student_id a different result is returned. otherwise (the student_id not passed) a bad request is returned.
but when it's deployed into AWS (Elasticbean stalk), the result is the same for any student_id even if there's no student_id present in the headers it still returns the result (the same result for the first request made on this API).
In my opinion, I guess it's a caching issue so I've tried to add a decorator @app.after_request but it didn't work
@application.after_request
def after_request(response):
response.headers['Last-Modified'] = str(http_date(datetime.now() - timedelta(days=1)))
response.headers["Cache-Control"] = "'no-store, no-cache, must-revalidate, post-check=0,
pre-check=0, max-age=0'"
response.headers["Expires"] = '-1'
response.headers["Pragma"] = "no-cache"
return response