rack-esi icon indicating copy to clipboard operation
rack-esi copied to clipboard

using Rack::ESI as middleware causes content not to display

Open karledurante opened this issue 14 years ago • 13 comments

I'm running a rails 2.3.11 project and when I include your gem and set the Rack::ESI middleware, the site no longer returns content. It seems that the request is processed, but the content is never returned to the browser.

karledurante avatar Aug 29 '11 16:08 karledurante

I'm working on a threaded version which will support Rails 2 and 3.

boof avatar Sep 28 '11 08:09 boof

Could you try again with the latest sources?

boof avatar Sep 28 '11 21:09 boof

will do, i'll let you know how it goes.

karledurante avatar Sep 29 '11 21:09 karledurante

Seems the same thing happens. According to the development.log, the page renders, but the content of the page is blank.

karledurante avatar Sep 29 '11 21:09 karledurante

Can you gist me some code/log?

boof avatar Sep 30 '11 05:09 boof

Is the source empty, too?

boof avatar Sep 30 '11 06:09 boof

This is my config in environment.rb

https://gist.github.com/1253963

And nothing comes back from the server (empty document). It seems that just by adding the config in the above jist causes the server to return no content (even if I call pages that don't make an esi call)

karledurante avatar Sep 30 '11 14:09 karledurante

please use :insert instead of :use for adding the middleware, and can you add the views/layouts to the gist?

boof avatar Oct 02 '11 05:10 boof

I used insert and get the error below (passenger error) when I attempt to access the site:

Error message: no implicit conversion from nil to integer Exception class: TypeError Application root: /Users/kdurante/projects/ci/site_content Backtrace:

File Line Location

0 /Users/kdurante/.rvm/gems/ree-1.8.7-2010.02@site_content/gems/actionpack-2.3.11/lib/action_controller/middleware_stack.rb 91 in insert' 1 /Users/kdurante/.rvm/gems/ree-1.8.7-2010.02@site_content/gems/actionpack-2.3.11/lib/action_controller/middleware_stack.rb 91 ininsert' 2 ./config/environment.rb 10
3 /Users/kdurante/.rvm/gems/ree-1.8.7-2010.02@site_content/gems/rails-2.3.11/lib/initializer.rb 111 in run' 4 ./config/environment.rb 9 5 config.ru 5 inrequire' 6 config.ru 5
7 /Users/kdurante/.rvm/gems/ree-1.8.7-2010.02@site_content/gems/rack-1.1.2/lib/rack/builder.rb 46 in instance_eval' 8 /Users/kdurante/.rvm/gems/ree-1.8.7-2010.02@site_content/gems/rack-1.1.2/lib/rack/builder.rb 46 ininitialize' 9 config.ru 1 in `new' 10 config.ru 1

karledurante avatar Oct 06 '11 01:10 karledurante

You can either use insert with a numeric integer or provide an already chained middleware you want to insert before, but that's Rails manual. For simplicity let's say insert at 0. It's important to insert rack-esi before a static file middleware is called so we can include static files.

Regards Florian

boof avatar Oct 06 '11 03:10 boof

My environment.rb file looks like this: config.middleware.insert(0, Rack::ESI)

And my layout/views/output looks like this: https://gist.github.com/1268114

As you can see, nothing gets rendered after the esi include.

karledurante avatar Oct 06 '11 17:10 karledurante

please only use paths (/pricing/delivery_quote), not full URIs (http://customink.local/pricing/delivery_quote).

boof avatar Oct 06 '11 19:10 boof

It's the same no matter what. I used paths originally and switched to
full uri's wondering if the request was even leaving the server.

Thanks, Karle

On Oct 6, 2011, at 3:27 PM, Florian Aßmann <reply+i-1511681-03e90f501ee6a7464aeb6661532e8f70018a605a@reply.github.co m> wrote:

please only use paths (/pricing/delivery_quote), not full URIs (http://customink.local/pricing/delivery_quote ).

Reply to this email directly or view it on GitHub: https://github.com/boof/rack-esi/issues/2#issuecomment-2313952

karledurante avatar Oct 06 '11 21:10 karledurante