Skip to content

Commit ffa3f2e

Browse files
add nofollow http-response rule
1 parent 757ad45 commit ffa3f2e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

manifests/haproxy/autoload.pp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
$http_edge_rules_all_real = Hash($http_edge_rules_all_real_without_undef)
9292

9393
# Insert additional http-edge rules that are service specific
94-
if 'canonicals' in $http_edge_services or 'status410' in $http_edge_services {
94+
if 'canonicals' in $http_edge_services or 'status410' in $http_edge_services or or 'nofollow' in $http_edge_services {
9595
if 'canonicals' in $http_edge_services {
9696
$http_edge_canonicals_rules_real = flatten($http_edge_rules_all_real['canonicals'], 'set-var(txn.canonical_custom) hdr(X-Canonical-Custom) if { hdr(X-Canonical-Custom) -m found }', 'del-header X-Canonical-Custom if { hdr(X-Canonical-Custom) -m found }')
9797
}
@@ -101,6 +101,8 @@
101101
'set-header link %[var(txn.canonical_custom)] if { var(txn.canonical_custom) -m found }'
102102
} elsif $service == 'status410' {
103103
'set-status 410 if { var(txn.status410) -m bool }'
104+
} elsif $service == 'nofollow' {
105+
'set-header X-Robots-Tag "noindex, nofollow" if { var(txn.noindex) -m bool }'
104106
}
105107
}
106108
$http_response_new_rules_real = $http_response_new_rules.filter |$rules| { $rules =~ NotUndef }
@@ -147,7 +149,7 @@
147149
}
148150

149151
$http_request_rules_hash = {$http_edge_frontend => {'options' => {'http-request' => $http_request_rules_real}}}
150-
if 'canonicals' in $http_edge_services or 'status410' in $http_edge_services {
152+
if 'canonicals' in $http_edge_services or 'status410' in $http_edge_services or 'nofollow' in $http_edge_services {
151153
$frontends_real_placeholder = deep_merge($ducktape::haproxy::frontends, $http_request_rules_hash)
152154
$frontends_real = deep_merge($frontends_real_placeholder, $http_response_rules_hash)
153155
} else {

0 commit comments

Comments
 (0)