I have a small project which has to response some files. I know that using nginx
will be better decision but that files a really small.
Part of my program:
In some cases the filename is still not visible. To have it for sure you should set "x-filename" header and to expose this header.
from flask import send_file
response = send_file(absolute_image_path, mimetype='image/jpeg', attachment_filename=name, as_attachment=True)
response.headers["x-filename"] = name
response.headers["Access-Control-Expose-Headers"] = 'x-filename'
return response