Bizarre lighttpd problem

I have code the works fine in webrick but when I use lighttpd it won’t
save anything to my database. I had run into something similar before
which I traced back to a print statement in my code. That’s not the
case here though. Here is output from firebug:

WORKS (webrick)
Cache-Control: no-cache
Connection: close
Date: Wed, 18 Oct 2006 13:49:31 GMT
Content-Type: text/javascript; charset=UTF-8
Server: WEBrick/1.3.1 (Ruby/1.8.4/2005-12-24)
Content-Length: 165
Set-Cookie: _session_id=05f05d72373a31ff76cbf0645d419618; path=/

DOES NOT WORK (lighttpd)
Connection: close
Transfer-Encoding: chunked
Content-Type: text/javascript
Set-Cookie: _session_id=36fa39df475fe2c6f2ddc5128076e478; path=/
Cache-Control: no-cache
Date: Wed, 18 Oct 2006 14:01:18 GMT
Server: lighttpd

Similar stuff, eh? Here is my controller code. Like I said, it’s not
saving to my mysql database when I use lighttpd but it does on webrick.

class MusiclikesController < ApplicationController

def liketune
@likemusic = Musiclike.new
@likemusic.music_id=params[:music_id]
@likemusic.vote_ip=params[:vote_ip]
@likemusic.save
end

end

It’s driving me nuts! Any lighttpd users run into this?

I’ve made some progress and tracked it down to the fact that lighttpd
does not capture the IP address correctly.

This code:

<%= @ip = request.remote_host %>

gives me back the IP address in webrick but does not return anything in
lighttpd

Is there a universal, web-server independent method to capture IP
address?

Thanks…

Vince W. wrote:

I’ve made some progress and tracked it down to the fact that lighttpd
does not capture the IP address correctly.

This code:

<%= @ip = request.remote_host %>

gives me back the IP address in webrick but does not return anything in
lighttpd

Is there a universal, web-server independent method to capture IP
address?

Ok, got it done with:

<%= @ip = request.env[“REMOTE_ADDR”] %>

Thanks…

Thanks for the post. I will want to use this for logging in my app.
The fact that no one responded just means that you’re smarter than
everyone else.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs