message: set x-robots-tag header with lua on autogen routes
diff: -# Load environment variable LAGOON_ENVIRONMENT_TYPE into nginx variable. LAGOON_ENVIRONMENT_TYPE will be replaced via envplate during docker-entrypoint
  -set $lagoon_environment_type '${LAGOON_ENVIRONMENT_TYPE:-development}';
  -
  -# By default no x-robots-tag
  -set $x_robots_tag '';
  -
  -# If this is an development environment do not index
  -if ($lagoon_environment_type = 'development') {
  - set $x_robots_tag 'noindex, nofollow';
  +# Load environment variable LAGOON_ENVIRONMENT_TYPE into nginx variable. LAGOON_ENVIRONMENT_TYPE will be replaced via envplate during docker-entrypo
  +header_filter_by_lua_block {
  + host = string.gsub(ngx.var.host, "%p", "%%%1")
  + if string.match ('${LAGOON_ENVIRONMENT_TYPE:-development}', 'development') then
  + ngx.header["X-Robots-Tag"] = 'noindex, nofollow';
  + elseif string.match ('${LAGOON_AUTOGENERATED_ROUTES:-default}',host) then
  + ngx.header["X-Robots-Tag"] = 'noindex, nofollow';
  + end
  }
  -
  -# actually add header (will not be added variable is empty)
  -add_header X-Robots-Tag $x_robots_tag always;
  