﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
1341	Inappropriately includes caching headers when error_page used with https://$host	lope@…		"'''Firstly''' it's quite silly that error_page 502 /foo uses port 80 when the connection is https on port 443.

'''Secondly''' if using something like this:
  proxy_pass $webappaddr;
  error_page 502 https://$host/maintenance/maintenance.html;
  expires 10y;

Nginx sends the browser a 302 Moved Temporarily header telling it to go to the https URL, and tells the browser to cache the 302 response for 10 years.

The problem is that this is an '''error state'''.
It's sending the browser 302 because the webapp is down.
'''The browser doesn't know that 302 is an error''', and so it respects the instruction to cache the ""Temporary"" redirect, temporarily for 10 years. So no user will ever see the webapp for the next 10 years.

Nginx should not be including expires >0 when responding to error_page anything.
Instead it would be far more appropriate if we can specify:
no_error { expires 10y; }
error {
 expires 0;
 add_header Cache-Control 'no-cache, no-store, must-revalidate';
}
Or NginX can do it automatically. Whatever the case may be, '''this is totally messed up as is'''."	defect	closed	critical		nginx-core	1.13.x	wontfix	error_page expires		Linux webserver 2.6.32-openvz-042stab113.11-amd64 #1 SMP Fri Dec 18 17:40:41 MSK 2015 x86_64 GNU/Linux	1.13.3
