# This config proxies 404 errors to any.yandex.ru 
# !! Enabled X-Yandex-NotFound-Landing - please, read documentation before use this config !! Not use it at _nonexistent_ hosts.
# There are interception of proxy errors, be aware - it will intercept any errors, not only 404 + special header (NotFound-404as200)
# Also there are set X-Yandex-NotFound-Project=autodetect to show 404 page specially configure for project, if it has own X-Yandex-NotFound-Project ID. 
# Read documentation, please - http://wiki.yandex-team.ru/morda/404

# This config can be used for nginx with proxy backend. 

proxy_intercept_errors on;

error_page 404 @404portal;

location @404portal {
	 proxy_set_header X-Real-IP $remote_addr;
	 proxy_set_header Host $host;
	 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	 proxy_set_header X-Yandex-NotFound-Project "autodetect";
	 proxy_set_header X-Yandex-NotFound-Landing 1;
	 proxy_set_header X-Yandex-NotFound-404as200 "On";
	 proxy_pass http://any.yandex.ru;
}

