Skip to content
Snippets Groups Projects
Commit 896c5691 authored by ale's avatar ale
Browse files

Use a map directly for the noindex header value

Another case of 'if is bad' in NGINX config. Better to just use
a map with a default empty value.
parent a094024b
No related branches found
No related tags found
1 merge request!265Add a NGINX config option to set X-Robots-Tag:noindex on specific URLs
Pipeline #32142 passed
# Global map used to forcefully prevent indexing of specific URLs.
# Configure via drop-in files in /etc/nginx/noindex/.
map $host$uri $noindex_url {
default 0;
map $host$uri $noindex_header {
default '';
include /etc/nginx/noindex/*.conf;
}
......
......@@ -21,10 +21,10 @@ this directory. The files should contain one entry per line, with the
syntax](http://nginx.org/en/docs/http/ngx_http_map_module.html):
```
"example.com/path/" 1;
"example.com/path/" noindex;
```
The value should always be set to 1.
The value should always be set to `noindex`.
Deindexing via HTTP header is described here:
......
......@@ -76,6 +76,5 @@ location {{ ep.path }}/ {
{% endfor %}
{% endfor %}
if ($noindex_url) {
add_header X-Robots-Tag noindex;
}
add_header X-Robots-Tag $noindex_header;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment