weepy
2007-Oct-17 02:00 UTC
Serious problem: fragment caching with named route and multiple mongrels
Hi I ran into what seemed to be a very serious problem with the way caching works. However it seems so serious that I wonder if I''m missing something very obvious ! Essentially if you use a filestore and a fragment cache with multiple mongrels and named routes you get key names like : /path/to/cache/128.0.0.1.8000/users/json /path/to/cache/128.0.0.1.8001/users/json /path/to/cache/128.0.0.1.8003/users/json Notice that different mongrels get a different directory. This is because fragment key is calculated with "url_for". The problem with this is obvious, since the fragments are not application wide and it depends which mongrel server the request is on to which folder it will look in. I managed to fix it by using a string rather than a named route, but I''m still fairly confused. I wonder whether its a feature, but I can''t see what it would be useful for! Jonah *...( --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
DHH
2007-Oct-18 15:41 UTC
Re: Serious problem: fragment caching with named route and multiple mongrels
> I managed to fix it by using a string rather than a named route, but > I''m still fairly confused. I wonder whether its a feature, but I can''t > see what it would be useful for!For when the host includes scoping information, like: /path/to/cache/david.highrisehq.com/users/json /path/to/cache/jonah.highrisehq.com/users/json The problem here seems to be that the reverse mapping is not setup correctly, such that Rails thinks that the host is localhost, instead of the external host. This will be a problem whenever url_for is used to create complete URLs and not just paths. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
weepy
2007-Oct-18 16:52 UTC
Re: Serious problem: fragment caching with named route and multiple mongrels
yes that makes sense - in fact the full list of folders that were being created were : /127.0.0.1:8000/ /127.0.0.1:8001/ /64squar.es/ /blog.64squar.es/ which indicates it was working sometimes. However "blog.64squar.es" is not being currently used but it does point to the same IP. anything I can look at to try to track it down ? This is on 1.2.5 BTW On Oct 18, 11:41 am, DHH <david.heineme...@gmail.com> wrote:> > I managed to fix it by using a string rather than a named route, but > > I''m still fairly confused. I wonder whether its a feature, but I can''t > > see what it would be useful for! > > For when the host includes scoping information, like: > > /path/to/cache/david.highrisehq.com/users/json > /path/to/cache/jonah.highrisehq.com/users/json > > The problem here seems to be that the reverse mapping is not setup > correctly, such that Rails thinks that the host is localhost, instead > of the external host. This will be a problem whenever url_for is used > to create complete URLs and not just paths.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Michael Koziarski
2007-Oct-18 20:43 UTC
Re: Serious problem: fragment caching with named route and multiple mongrels
> which indicates it was working sometimes. However "blog.64squar.es" is > not being currently used but it does point to the same IP. > > anything I can look at to try to track it down ? This is on 1.2.5 BTWYou probably don''t have an X-Forwarded-For header? Without that request.host will default to localhost:port. You''d have the same problem with generated urls from your application, all those links will be pointing to http://127.0.0.1:3000/people etc -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
weepy
2007-Oct-18 22:35 UTC
Re: Serious problem: fragment caching with named route and multiple mongrels
I dont have a problem with the generated urls. It''s on a production site with lots of users - so I''d have found out about those ! It''s a standard deprec install on ubuntu with rails 1.2.5 and apache. totally out of the box and vanilla . Where would I set X-Forwarded-For header ? Thanks Jonah On Oct 18, 4:43 pm, "Michael Koziarski" <mich...@koziarski.com> wrote:> > which indicates it was working sometimes. However "blog.64squar.es" is > > not being currently used but it does point to the same IP. > > > anything I can look at to try to track it down ? This is on 1.2.5 BTW > > You probably don''t have an X-Forwarded-For header? Without that > request.host will default to localhost:port. > > You''d have the same problem with generated urls from your application, > all those links will be pointing tohttp://127.0.0.1:3000/peopleetc > > -- > Cheers > > Koz--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Jack Danger Canty
2007-Oct-18 22:42 UTC
Re: Serious problem: fragment caching with named route and multiple mongrels
On 10/18/07, weepy <jonahfox@gmail.com> wrote:> > > I dont have a problem with the generated urls. It''s on a production > site with lots of users - so I''d have found out about those !I think Koz meant that url_for() helper would be having problems. If you''re just using path helpers (like person_path(@person)) or url_for with '':only_path => true'' then you may not be seeing the errors. Try putting a link to url_for(:controller => ''users'') on your production site and see what pops up. The X-Forwarded-For header needs to be set by your world-facing server (e.g. Apache, Nginx). Good luck! ::Jack Danger --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---