Forum: Rails deployment Mongrel, Nginx, and AJAX not working

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.
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-07-24 19:11
(Received via mailing list)
Under Apache / FastCGI, the following request is perfectly fine (as
pulled
from the browser's View Source):

new
Ajax.Request('http://server/portals?editable=true&update=por...,
{asynchronous:true, evalScripts:true, method:'get'})


However, under my new setup of Nginx and Mongrels, the call never
returns. I
get the proper log in production.log, stuff happens, and my browser just
sits there twiddling it's thumbs, never getting what it wants back
(note:
the update *is* meant to be part of the GET string).

Has anyone else had a problem with this kind of setup? It feels that
AJAX
responses are getting stopped by Nginx but I can't find anything out
about
this.

Thanks

Jason
26ca684555abbdb44f01bd1e165e649b?d=identicon&s=25 Vince W. (vince)
on 2007-07-24 19:22
(Received via mailing list)
I know this isn't the answer you're looking for, but I ran into issues
like this at least 3 times with lighttpd which is why I switched to
nginx/mongrel.  Each time I had a problem, firebug was essential in
figuring out the problem.. maybe take a look at the output from
firebug and see if it helps..

-Vince

On 7/24/07, Jason Roelofs <jameskilton@gmail.com> wrote:
> the update *is* meant to be part of the GET string).
>
--
support independent business -- http://www.buyindie.net/
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-07-24 19:30
(Received via mailing list)
Yeah, I've been watching Firebug, the request just spins until it times
out.
Getting back into the server works no problem, but there's nothing
coming
back to my browser.

Thanks though. Interesting that you had this same problem with lighty.

Jason
8c43ed7f065406bf171c0f3eb32cf615?d=identicon&s=25 Zed A. Shaw (Guest)
on 2007-07-24 22:57
(Received via mailing list)
On Tue, 24 Jul 2007 13:10:42 -0400
"Jason Roelofs" <jameskilton@gmail.com> wrote:

> Under Apache / FastCGI, the following request is perfectly fine (as pulled
> from the browser's View Source):
>
> new Ajax.Request('http://server/portals?editable=true&amp;update=por...,
> {asynchronous:true, evalScripts:true, method:'get'})

What happens when you do & rather than &amp; ?

--
Zed A. Shaw
- Hate: http://savingtheinternetwithhate.com/
- Good: http://www.zedshaw.com/
- Evil: http://yearofevil.com/
615c3ad6684a2831d34bbc8b5d1d2015?d=identicon&s=25 Pascal Belloncle (Guest)
on 2007-07-25 06:57
(Received via mailing list)
I had a very similar thing happen a few days ago and found a solution
for my problem last night.  That was Ajax request and firebug was
showing the request as spinning and spinning...

The code was using Ajax.Request with a post (not a get), and worked
fine just with mongrel, but through nginx, it was taking 120s to get
back to that Complete state (and, although I'm not sure why, the
reason it was taking 120s was probably that another Ajax request was
being fired up every 120s).

The code responding to the request couldn't be simpler:

     render :text => @mailbox.count.unseen

unseen happens to return an integer, not a string.  And when trying
with a string it worked

     render :text => "1234567890"

So just for a moment I thought it was the size of the request, but
even a 1 byte string did not make any difference and still worked. So
just changing that line to:

     render :text => @mailbox.count.unseen.to_s

fixed it for me.  I have not attempted to figure out further what was
happening, but my best theory is that the mime type returned by rails
(mongrel?) may be different and nginx (or the browser?) is waiting
for more to send the response back).

Not sure the same thing is happening in your case, but that may be
worth looking more closely at the mime type.

Cheers,
Pascal.
--
http://blog.nanorails.com
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-07-27 17:02
(Received via mailing list)
Follow-up:

I honestly do not know what I did, but it's working now. I did install
swiftiply to use it's evented_mongrel handler, so there might be
something
there that fixed the problem but I'm not sure.

Thanks for all of your suggestions.

Jason
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-07-27 19:34
(Received via mailing list)
Follow-up # 2

Ignore previous post, I'm still stuck, though I know what's wrong now.
This
is a site migration so traffic already exists to the url. I put up the
site
on the new box under a different url to see if it works and sure enough,
it
was snappy and perfect. Thinking all was good, I changed the DNS entry
for
the real URL and bam, back to a broken site.

So this is a load balancing issue then, or at least that's what it looks
like. I now know the whole stack works, but under a site that gets
constant
but in no ways heavy load, requests responses get lost. Literally.

As for the mime type, I'll definitely look into that but all of my
responses
are RJS and thus strings.

Ug...

Jason
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-07-27 22:30
(Received via mailing list)
So I just decided to bypass the problem and move to a different URL. Not
going to deal with it if I can just get around it.

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