{% if ERRORS != "" %}
	{% for element in ERRORS.split(" ") %}
		{% set code = element.split("=")[0] %}
		{% set page = element.split("=")[1] %}
error_page {{ code }} {{ page }};

location = {{ page }} {
    root {{ ROOT_FOLDER }};
    modsecurity off;
    internal;
}
	{% endfor %}
{% endif %}

{% set default_errors = ["400", "401", "403", "404", "429", "500", "501", "502", "503", "504"] %}
{% for default_error in default_errors %}
	{% if not default_error + "=" in ERRORS +%}
error_page {{ default_error }} /errors/{{ default_error }}.html;

location = /errors/{{ default_error }}.html {
    root /opt/bunkerized-nginx/defaults;
    modsecurity off;
    internal;
}
	{% endif %}
{% endfor %}
