Hi
I really would like to use Varnish caching with the robots.txt so we can avoid Drupal bootstrap at all. My bootstrap is around 200ms and Varnish can serve the file in 75ms and no apache thread.
For this I think would be best to use standard page caching mechanism as this is easily setup globally and supported by core.
This is basically the same solution as in this issue for the Redirect module #1392974: cache control headers are not correctly added to redirects
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | send_cache_headers-1923838-7.patch | 568 bytes | dokumori |
| #5 | send_cache_headers-1923838-5.patch | 393 bytes | rbrandon |
| robotstxt-cache-headers.patch | 542 bytes | kars-t |
Comments
Comment #1
dawehner:)
Comment #2
kars-t commentedOh how could I forget this -_- thx!
Comment #3
hass commentedShould we better issue drupal_page_footer() than drupal_exit()?
Comment #4
dawehnerYeah why not!
Comment #4.0
dawehnerEnhanced text
Comment #5
rbrandon commentedThis is good enough for varnish if someone would like a simpler patch in the interm.
Why not have the function return NULL instead of drupal_exit()? This will call drupal_deliver_page as usual without sending any extra data which will call drupal_page_footer() etc.
Comment #6
dokumori commented+1 to @rbrandon's suggestion on returning null. I may be short-sighted, but if the objective here is simply to return robots.txt, I don't see why implementations of hook_exit need to be called.
I'll modify @Kars-T's patch and see how it goes.
Comment #7
dokumori commentedWill test and report back:
Comment #8
hass commentedShould we go with #5 now?
Comment #9
hass commentedI guess we should go with drupal_page_footer() as we had the same discussion already in #1858178: call to exit in callback function breaks page caching, but it seems like we have implemented the wrong fix with drupal_exit().
Comment #10
hass commentedhttp://drupalcode.org/project/robotstxt.git/commit/cc4e8f0
Comment #13
hass commentedSuxxx. This may introduced #2296351: Exit after drupal_page_footer()
Comment #14
hass commented