Reputation: 2576
I'm having problem on a particular device (iPhone SE, iOS 9.3.5). Reading this other SO post, it seems that safari thinks that the web server is using HTTP/0.9, and the issue can be solved by including the HTTP version in the response. I'm using templates, if that matters.
I've tried this:
@downloader.route('/')
def home():
return render_template('home.html', name=get_guest_name()), "HTTP/1.1 200 OK", {"Content-Type": "text/html"}
But this does not seem to work. Desktop browsers and other mobile devices work just fine.
Upvotes: 0
Views: 788
Reputation: 8587
You want to wrap your render_template()
result (which is a str
) in a Response
using make_response()
, attach the desired headers, e.g. along these lines:
@downloader.route('/')
def home():
resp = make_response(render_template('home.html', name=get_guest_name()))
resp.headers['Content-Type'] = 'text/html'
return resp
You could make this into decorator to have it easily reusable.
Upvotes: 2