On my host I run my lighttpd instance bound to a specific port and my hostname is mapped to this port (I'm not exactly sure how this is accomplished, but it is lighttpd also listening on port 80 which handles this for me I believe). A redirect from rails includes my local port number in the request, so that it shows up in the address bar. I prefer people not to see this - I don't want bookmarks saved with it for example in case I move my host or port. I have this issue both with my custom application and with Typo. In my app I tried url_for :only_path => true which didn't seem to help, and I'm not enamored with doing this in Typo and then re-doing it if I ever upgrade, is there a way to "hide" the port number from rails?
on 2006-03-21 15:29
on 2006-03-21 15:33
Jeremy - who do you host with? I imagine your config is something like this: Apache (port 80) -> Lighttpd (some port) -> FCGI -> Rails This is how my apps are handled. When you visit your app's site, are you calling it with the port name added or by host name? Do you care to show an example URL that we can try?
on 2006-03-21 23:32
I'm hosted with theinternetco.net. Apache couldbe on port 80 but if you just go to that IP address (no host name) then you see Lighty's start page. An example URL is in my sig - www.jeremyhuffman.com but you have to login to the admin section to see the redirect issue. I can construct a simple example of how to see the issue if you think it would help.
on 2006-03-22 02:12
Actually I just realized, you can see the issue if you access http://www.jeremyhuffman.com/admin since it will redirect for a login prompt. I think it is lighty doing the port mapping because of what you see when you just look at that IP: http://126.96.36.199 On 3/21/06, Jeremy Huffman <email@example.com> wrote: > On 3/21/06, Michael Gorsuch <firstname.lastname@example.org> wrote: > > > don't > > > > > > > Jeremy Huffman > http://www.jeremyhuffman.com -- Jeremy Huffman http://www.jeremyhuffman.com
on 2006-03-23 01:02
The other odd thing about this, is that it is only an issue if I bind my *own* lighty to my port for FastCGI. If I just run webrick the issue doesn't appear. So it becomes harder to blame a strange configuration with whatever proxies for me. Still, if no one else is seeing this issue then its clearly related to my configuration. And I suppose I should just ask my admin for help - I was just hoping there was an easy work around for it in rails. On 3/21/06, Jeremy Huffman <email@example.com> wrote: > I have this issue both with my custom application and with Typo. In my app I > tried url_for :only_path => true which didn't seem to help, and I'm not > enamored with doing this in Typo and then re-doing it if I ever upgrade, is > there a way to "hide" the port number from rails? > > > > > -- > Jeremy Huffman > http://www.jeremyhuffman.com -- Jeremy Huffman http://www.jeremyhuffman.com
on 2006-03-23 02:09
>> (I'm not exactly sure how this is >> accomplished, but it is lighttpd also listening on port 80 which >> handles >> this for me I believe). Sorry, I am having trouble interpreting this. Does this mean your site is using port 80? A http request contains the domain and port. The httpd (or lighttpd) process looks for a matching domain and port in your configuration and generate the page (if it exists) as a response. If no port is specified it defaults to port 80, but https connection default to 443. If you are not using port 80 (or 443) then you cannot hide the port from the user. If you are using port 80 then it sounds like your site configuration in the httpd process has defined the port within the domain somehow. -John -- John Smilanick Computing Staff - Webmaster Kavli Institute for Theoretical Physics University of California, Santa Barbara firstname.lastname@example.org (805) 893-6307
on 2006-03-23 03:42
My host has a lighty instance listening on port 80 that proxies to my port, 5194. I can run any process I want on my port. If I run my app with webrick everything is fine, the browser only talks to port 80 and its proxied based on the host header - the end user has no way of knowing about port 5194. Rails also thinks its running on port 80 and when it redirects it redirects to host http://www.jeremyhuffman.com so everything remains fine. If I run my own lighty process and dispatch.fcgi then rails finds that the host name is http://www.jeremyhuffman.com:5194 and will redirect to this URL. I want rails to not include the reverse proxy port in its redirects. On 3/22/06, John Smilanick <email@example.com> wrote: > > > > > > http://www.jeremyhuffman.com > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > -- Jeremy Huffman http://www.jeremyhuffman.com
on 2006-03-23 04:00
Jeremy- As far as I know lighty as a front proxy like that can't do the reverse proxy like you want. Apache fronts like what you are describing use ProxyPass and ProxyPassReverse to do the forward/ backward proxy. Lighty doesn't do reverse proxies. So unless you can get the host to switch to an apache front or someone knows a hack to make lighty do reverse proxies I think you're stuck with the post number in the url. Here is a few apache vhosts that do the right thing and let you run lighty on a higher port without the port num showing up in the url: http://brainspl.at/articles/2005/11/08/apache-vhos... lighttpd-on-a-higher-port -Ezra
on 2006-03-23 14:03
Well, in fact it *IS* working and if you read my post or clicked the URL you would understand that. I suppose it must be apache doing the front if Lighty can't do it; I really don't know the configuration I just know everything is fine UNTIL Rails does a redirect. So in fact there is a ReverseProxy.