Update about FLASK:
as you indicated in:
I am using errorhandler decorator, but returning a template in the handler function:
@application.errorhandler(404)
def error_404(e):
application.logger.error('Page Not Found: %s', (request.path))
#return render_template('404.html'), 404
return render_template("404.html", error = str(e))
In this situation, it is not clear to me if nginx will read a 200 response, for actually the template 404.html is found, or the 404 error, handled by the decorator.
Actually, with the suggestions from:
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid
I can see:
/api/_invalidpage
returned header: X-Proxy-Cache: MISS and it is not cached now.
while
/_invalidpage/ (the page a user will see for that specific page)
returned X-Proxy-Cache: HIT
I would like to cache the html template but not the 404 api response.
I think now is correct but would appreciate a clarification on how a template is handled inside handleerror in flask, to better understand how things works.