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? -- Jeremy Huffman http://www.jeremyhuffman.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060321/db68b9b7/attachment.html
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 3/21/06, Jeremy Huffman <jeremy@jeremyhuffman.com> wrote:> > 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? > > > > > -- > Jeremy Huffman > http://www.jeremyhuffman.com > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
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 3/21/06, Michael Gorsuch <michael.gorsuch@gmail.com> wrote:> > 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 3/21/06, Jeremy Huffman <jeremy@jeremyhuffman.com> wrote: > > > > 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? > > > > > > > > > > -- > > Jeremy Huffman > > http://www.jeremyhuffman.com > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jeremy Huffman http://www.jeremyhuffman.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060321/b9e22ab5/attachment.html
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://204.10.124.77 On 3/21/06, Jeremy Huffman <jeremy@jeremyhuffman.com> wrote:> > 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 3/21/06, Michael Gorsuch <michael.gorsuch@gmail.com> wrote: > > 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 3/21/06, Jeremy Huffman < jeremy@jeremyhuffman.com> wrote: > > > > > > 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? > > > > > > > > > > > > > > > -- > > > Jeremy Huffman > > > http://www.jeremyhuffman.com > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > -- > > Jeremy Huffman > http://www.jeremyhuffman.com-- Jeremy Huffman http://www.jeremyhuffman.com
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 <jeremy@jeremyhuffman.com> wrote:> > 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? > > > > > -- > Jeremy Huffman > http://www.jeremyhuffman.com-- Jeremy Huffman http://www.jeremyhuffman.com
>> (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 jsmilani@kitp.ucsb.edu (805) 893-6307 On Mar 22, 2006, at 4:02 PM, Jeremy Huffman wrote:> 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 <jeremy@jeremyhuffman.com> wrote: >> >> 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? >> >> >> >> >> -- >> Jeremy Huffman >> http://www.jeremyhuffman.com > > > -- > Jeremy Huffman > http://www.jeremyhuffman.com > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060323/7d5181f9/attachment-0001.html
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 <jsmilani@kitp.ucsb.edu> wrote:> > > (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 > jsmilani@kitp.ucsb.edu > (805) 893-6307 > > > On Mar 22, 2006, at 4:02 PM, Jeremy Huffman wrote: > > > 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 <jeremy@jeremyhuffman.com> wrote: > > 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? > > > > > -- > Jeremy Huffman > http://www.jeremyhuffman.com > > > -- > Jeremy Huffman > http://www.jeremyhuffman.com > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >-- Jeremy Huffman http://www.jeremyhuffman.com
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-vhost-to-proxy-thru-to- lighttpd-on-a-higher-port -Ezra On Mar 22, 2006, at 6:41 PM, Jeremy Huffman wrote:> 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 <jsmilani@kitp.ucsb.edu> wrote: >> >> >> (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 >> jsmilani@kitp.ucsb.edu >> (805) 893-6307 >> >> >> On Mar 22, 2006, at 4:02 PM, Jeremy Huffman wrote: >> >> >> 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 <jeremy@jeremyhuffman.com> wrote: >> >> 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? >> >> >> >> >> -- >> Jeremy Huffman >> http://www.jeremyhuffman.com >> >> >> -- >> Jeremy Huffman >> http://www.jeremyhuffman.com >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> > > > -- > > Jeremy Huffman > http://www.jeremyhuffman.com > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
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. On 3/22/06, Ezra Zygmuntowicz <ezra@yakimaherald.com> wrote:> > 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-vhost-to-proxy-thru-to- > lighttpd-on-a-higher-port > > -Ezra > > On Mar 22, 2006, at 6:41 PM, Jeremy Huffman wrote: > > > 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 <jsmilani@kitp.ucsb.edu> wrote: > >> > >> > >> (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 > >> jsmilani@kitp.ucsb.edu > >> (805) 893-6307 > >> > >> > >> On Mar 22, 2006, at 4:02 PM, Jeremy Huffman wrote: > >> > >> > >> 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 <jeremy@jeremyhuffman.com> wrote: > >> > >> 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? > >> > >> > >> > >> > >> -- > >> Jeremy Huffman > >> http://www.jeremyhuffman.com > >> > >> > >> -- > >> Jeremy Huffman > >> http://www.jeremyhuffman.com > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > >> > >> > >> > > > > > > -- > > > > Jeremy Huffman > > http://www.jeremyhuffman.com > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Jeremy Huffman http://www.jeremyhuffman.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060323/b819b8c6/attachment-0001.html