Nginx custom autoindex with XSLT

Updated at by

I received a warning from Google Search Console stating "Clickable elements too close together" on an autoindexed page called dump. XSLT to the rescue!

yum install -y nginx-module-xslt
echo "load_module modules/ngx_http_xslt_filter_module.so;" > /usr/share/nginx/modules/xslt.conf

After creating the stylesheet ../dump/autoindex.xslt

location /dump {
  autoindex on;
}

Became

location /dump {
  autoindex on;
  autoindex_format xml;
  xslt_stylesheet /var/www/ospi.fi/dump/autoindex.xslt;
}

As Nginx parses the XSLT only during startup one final systemctl reload nginx is needed and Clickable Element Closeness is fixed.


Share on FacebookShare on Facebook Share on TwitterShare on Twitter

Leave a comment