diff --git a/robotstxt.module b/robotstxt.module
index 1f098f5..b3935d4 100644
--- a/robotstxt.module
+++ b/robotstxt.module
@@ -69,6 +69,12 @@ function robotstxt_robots() {
 
   drupal_add_http_header('Content-type', 'text/plain');
   echo implode("\n", $content);
+  if ($cache = drupal_page_set_cache()) {
+    // When caching the robots.txt for the first time we still need to ensure
+    // that the correct cache headers are sent.
+    // @see drupal_page_footer()
+    drupal_serve_page_from_cache($cache);
+  }
   drupal_exit();
 }
 
