Detecting protocol with proxy

Hey,

I’m trying to use apache to proxy requests through to one rails instance
(lighttpd) for both secure and insecure pages. I want to do this by
applying filters (a nice 20 line solution) that look at the protocol and
redirect the user where appreciate (i.e. http://domain/login
https://domain/login).

When I try this the redirect happens…and happens…and happens; Apache
handles the https request, but rails decides that it’s still a plain old
http request and redirects again. What’s interesting is that it gets
the
SERVER_NAME from apache (it’s in the logs), so it’s getting the URL but
not the protocol.

I understand that from rails’ perspective this probably does look like
an
http request, it after all fields an http request even if apache is
securing the network connection. Even so, any ideas on how to get
around
this? How are other folks handling showing users secure pages for
things
like logins, password changes, viewing sensitive docs, etc and http for
everything else?

Thanks,

pt.

Parker T.
Professional
(w) http://placesite.com
(c) 510.541.0125