Add header on custom error page

i’m trying to add a ‘X-ua-compatible’ header on a custom 444 error
page like below. but this does not work. do you have any suggestions
on how to do this?

Any advise will be appreciated.


error_page 444 = @err_444;

location = /xxx {
return 444;

  location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass   unix:/var/run/php.sock;
    fastcgi_param  SCRIPT_FILENAME 

include /etc/nginx/fastcgi_params;

location @err_444 {
add_header X-ua-compatible ‘IE=EmulateIE8’;
rewrite ^ /index.php?url=err/444?;

add_header is effective only when the response code is equal to 200,
204, 301, 302 or 304. You should try headers_more module.

Posted at Nginx Forum: