cache all endpoints but one: nginx settings

gg4u nginx-forum at
Mon Oct 10 19:34:50 UTC 2016

Update about FLASK:

as you indicated in:

I am using errorhandler decorator, but returning a template in the handler

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:

I can see:
returned header: X-Proxy-Cache: MISS and it is not cached now.
/_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.

Posted at Nginx Forum:,270058,270168#msg-270168

More information about the nginx mailing list