How can I use varnish to generate a robots.txt file even for subdomain of the same site?
- by Sam
I want to generate a robots.txt file using Varnish 2.1.
That means that domain.com/robots.txt is served using Varnish and also subdomain.domain.com/robots.txt is also served using Varnish.
The robots.txt must be hardcoded into default.vcl file. is that possible?
I know Varnish can generate a maintenance page on error. I'm trying to make it generate a robots.txt file. Can anyone help?
sub vcl_error {
set obj.http.Content-Type = "text/html; charset=utf-8";
synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Maintenance in progress</title>
</head>
<body>
<h1>Maintenance in progress</h1>
</body>
</html>
"};
return (deliver);
}