HAProxy: serve static robots.txt from Files section
-
I am using HAProxy 2.4.9-f8dcd9f on pfSense 2.6.0, although I am planning to upgrade to pfSense 2.8.0 within the next two weeks.
I need to serve a static
robots.txtfile for every request to/robots.txton an HAProxy frontend, so I created therobots.txtfile in the Files section:
Now I am having trouble creating the correct rule to serve that file for every
GET /robots.txtrequest.If I create a
Robots_Filebackend with the following rule, it works:http-request return status 200 content-type "text/plain; charset=utf-8" hdr Cache-Control "no-store, max-age=0" lf-string "User-agent: *\nDisallow: /\n"However, since I need a much more complex
robots.txt, I would prefer to serve the static file instead of embedding the file content directly in the rule.Could someone please help me understand what the correct HAProxy rule would be in this case?
Thank you very much.
Copyright 2026 Rubicon Communications LLC (Netgate). All rights reserved.