Forum: Radiant CMS Sendfile headers

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (seancribbs)
on 2009-01-30 19:24
(Received via mailing list)
Last night at our little hack session at John's, I added the ability to
support X-Accel-Redirect headers for nginx.  It would be great if
someone could test this addition with nginx.  In config/environment.rb,
put this line inside the config.after_initialize block:

ResponseCache.defaults[:use_x_accel_redirect] = true

Since I have seancribbs.com running the latest and hosted using
Apache/Passenger, I decided to turn on X-Sendfile headers.  However,
Apache doesn't seem to recognize them and just serves up a blank
response (with the X-Sendfile header included in the response).  So my
questions are two:

1) Is this just a side-effect of using Passenger? Would a proxy scenario
(Mongrel, Thin, etc) work?
2) Is there something different Radiant should be doing with other
headers to make it work?

Additionally, if anyone could look into conditional GETs and make sure
we're doing it right, that would be great.

Sean
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (seancribbs)
on 2009-01-31 00:13
(Received via mailing list)
It seems my problem is that "EnableSendfile" in Apache core is not the
same thing as X-Sendfile.  Installing mod_xsendfile fixes the problem.

That said, anyone who can test with nginx - please report!

Sean
491892349b82ad4e00d71eb844768147?d=identicon&s=25 Steven Southard (Guest)
on 2009-01-31 02:06
(Received via mailing list)
Once a page has comments there is a link in the admin of that page to
view comments and if I click on it I get an application error.  This
is what the production log says:


  Parameters: {"action"=>"index", "page_id"=>"5", "controller"=>"admin/
comments"}
Cookie set: session_token=a7c8382524930cc092981330cf62fc75f8a68582;
path=/; expires=Sat, 14 Feb 2009 00:43:07 GMT
Rendering template within layouts/application
Rendering admin/comments/index


ActionView::TemplateError (undefined method `page_edit_url' for
#<ActionView::Base:0x93fe360>) on line #1 of admin/comments/index.rhtml:
1: <h1><%= @page.nil? ? "#{params[:status].titleize if
params[:status]} Comments" : "#{@page.comments_count}
#{pluralize(@page.comments_count, "Comment")} on
#{link_to(@page.title, page_edit_url(@page.id))}" %></h1>
2:
3: <p class="comment-nav">
4:   View:

     vendor/extensions/comments/app/views/admin/comments/index.rhtml:
1:in
`
_run_erb_47vendor47extensions47comments47app47views47admin47comments47index46rhtml
'
     vendor/rails/actionpack/lib/action_view/base.rb:342:in `send'
     vendor/rails/actionpack/lib/action_view/base.rb:342:in `execute'
     vendor/rails/actionpack/lib/action_view/template_handlers/
compilable.rb:29:in `send'
     vendor/rails/actionpack/lib/action_view/template_handlers/
compilable.rb:29:in `render'
     vendor/rails/actionpack/lib/action_view/template.rb:35:in `render'
     vendor/rails/actionpack/lib/action_view/template.rb:22:in
`render_template'
     vendor/rails/actionpack/lib/action_view/base.rb:248:in
`render_file'


What do I do about this undefined method 'page_edit_url'?

Thanks for any help,

Steven
09477c358c5897d44121a248326e16d7?d=identicon&s=25 Jim Gay (Guest)
on 2009-01-31 03:07
(Received via mailing list)
Comments may not have been updated for Radiant 0.7 (which did not
preserve named routes from earlier versions)
I believe it should be edit_admin_page_url now, assuming you are on
edge Radiant.
491892349b82ad4e00d71eb844768147?d=identicon&s=25 Steven Southard (Guest)
on 2009-01-31 03:41
(Received via mailing list)
Thank you Jim.  I bet you're right.


Steven
A50dcaaf8e545e6cc1fb4e32919be6ad?d=identicon&s=25 Jason Garber (jgarber)
on 2009-02-02 22:22
(Received via mailing list)
Sean, did you use my page_attachments_xsendfile extension?  If not,
I'm curious how you set it up.

Jason
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (seancribbs)
on 2009-02-02 22:51
(Received via mailing list)
Jason,

This doesn't affect page_attachments.  For Apache, I compiled and
installed mod_xsendfile, and then added these two directives to my
Apache config:

XSendfile on
XSendFileAllowAbove on

And this line to config/environment.rb, inside the after_initialize
block:

ResponseCache.defaults[:use_x_sendfile] = true

Sean
A50dcaaf8e545e6cc1fb4e32919be6ad?d=identicon&s=25 Jason Garber (jgarber)
on 2009-02-03 05:03
(Received via mailing list)
And did it work in production?  When I did exactly that (probably 4
months ago), I found sometimes I would get a blank page or the plain
text version of the cache file.  I didn't have time to figure it out,
so I just turned it off again.
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (seancribbs)
on 2009-02-03 05:13
(Received via mailing list)
I got blank pages occasionally until I installed mod_xsendfile
properly.  Then, It Just Worked(tm).

Sean
Efc9d9d149b91368c764d4eaee4c58ca?d=identicon&s=25 john muhl (Guest)
on 2009-02-03 06:11
(Received via mailing list)
i've been using the old x-sendfile patch on nginx and mongrel for about
a
year with no blank page issues. after setting up an edge 0.7 in a
virtual
machine i was able to run nginx and thin in production mode with no
blank
pages in well over a million requests through ab (assuming those blank
pages
would report their size differently than the page that was supposed to
be
served).
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (seancribbs)
on 2009-02-03 14:26
(Received via mailing list)
They wouldn't report a different size (all other headers are preserved),
but the header gives the file a fast-track through the web-server and
operating system.  Essentially, it tells the OS to stream the file to
the socket, on OS's that support it.

Sean
Efc9d9d149b91368c764d4eaee4c58ca?d=identicon&s=25 john muhl (Guest)
on 2009-02-08 22:54
(Received via mailing list)
what type of system did you install mod_xsendfile on? it's completely
broken
for 64bit httpd on osx.
8802b1fa1b53e2197beea9454244f847?d=identicon&s=25 Sean Cribbs (seancribbs)
on 2009-02-08 23:02
(Received via mailing list)
I installed on 64-bit Ubuntu 8.10. (seancribbs.com)

Sean
This topic is locked and can not be replied to.