I am using Apache2.2 + Mongrel on my machine. Now I am accessing it over LAN. When I enter http://mymachinename/myapp it opens fine but when I click on any link in my rails app, it replaces mymachinename with localhost (http://localhost/myapp/controller/action) and thus I am unable to access it from remote location.
On 11/7/07, Geek Moth <geekmoth at gmail.com> wrote:> > I am using Apache2.2 + Mongrel on my machine. > Now I am accessing it over LAN. When I enter http://mymachinename/myapp > it opens fine but when I click on any link in my rails app, it replaces > mymachinename with localhost (http://localhost/myapp/controller/action) > and thus I am unable to access it from remote location.Geek, It sounds to me like your apache is not passing the hostname through properly. Not enough information here for me to help more than that. Good luck, ~Wayne -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/mongrel-users/attachments/20071107/c308c4cb/attachment.html
Quoting Geek Moth <geekmoth at gmail.com>:> I am using Apache2.2 + Mongrel on my machine. > Now I am accessing it over LAN. When I enter http://mymachinename/myapp > it opens fine but when I click on any link in my rails app, it replaces > mymachinename with localhost (http://localhost/myapp/controller/action) > and thus I am unable to access it from remote location.Why are your links absolute urls at all? Are you using absolute or relative link syntax in your rails app? W/o more info, it isn''t clear where the ''http://localhost/'' part is being introduced into the equation. -- Cynthia Kiser
what kind of info is required to clear it more? Like my httpd-proxy.config file? Thats the only thing I added to the system. -- Posted via http://www.ruby-forum.com/.
here it is... ======LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> Alias /myapp "c:/rails/myapp/public" Alias /images "c:/rails/myapp/public/images" Alias /stylesheets "c:/rails/myapp/public/stylesheets" Alias /javascripts "c:/rails/myapp/public/javascripts" <Directory "c:/rails/myapp/public"> Options Indexes FollowSymLinks AllowOverride none Order allow,deny Allow from all </Directory> ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! ProxyPass /myapp/ http://127.0.0.1:4000/ ProxyPass /myapp http://127.0.0.1:4000/ ProxyPassReverse /myapp/ http://127.0.0.1:4000/ ProxyPassReverse /myapp http://127.0.0.1:4000/ ====== And there''s following like in Apache''s httpd.conf Include conf/httpd-webrick-proxy.conf -- Posted via http://www.ruby-forum.com/.
Quoting Vapor .. <lists at ruby-forum.com>:> what kind of info is required to clear it more? > Like my httpd-proxy.config file? > Thats the only thing I added to the system.Give an example of the rails code that generates on of the links that says localhost. Are you using link_to? Then, yes, show us your proxy configuration (with sensitive info xxxx''ed out) -- Cynthia Kiser
Cynthia Kiser wrote:> Quoting Vapor .. <lists at ruby-forum.com>: >> what kind of info is required to clear it more? >> Like my httpd-proxy.config file? >> Thats the only thing I added to the system. > > Give an example of the rails code that generates on of the links that > says localhost. Are you using link_to? > > Then, yes, show us your proxy configuration (with sensitive info > xxxx''ed out) > > -- > Cynthia Kiseryes exactly... <%= link_to(''Home'', :controller => ''post'', :action => ''index'') %> Isn''t it right? -- Posted via http://www.ruby-forum.com/.
Your Rails code looks fine and should give you normal urls as far as I can see. I am afraid I don''t use ProxyPass and Directory directives; I use mod_rewrite + VirtualHost stanzas. So I hope someone else on the list can see what is funky. At a glance, this stanza looks fairly normal - though I haven''t see folks do /myapp and /images in parallel. Is your Rails site a subsection of another site? Quoting Vapor .. <lists at ruby-forum.com>:> here it is... > > ======> LoadModule proxy_module modules/mod_proxy.so > LoadModule proxy_http_module modules/mod_proxy_http.so > ProxyRequests Off > <Proxy *> > Order deny,allow > Allow from all > </Proxy> > > Alias /myapp "c:/rails/myapp/public" > Alias /images "c:/rails/myapp/public/images" > Alias /stylesheets "c:/rails/myapp/public/stylesheets" > Alias /javascripts "c:/rails/myapp/public/javascripts" > <Directory "c:/rails/myapp/public"> > Options Indexes FollowSymLinks > AllowOverride none > Order allow,deny > Allow from all > </Directory> > > ProxyPass /images ! > ProxyPass /stylesheets ! > ProxyPass /javascripts ! > ProxyPass /myapp/ http://127.0.0.1:4000/ > ProxyPass /myapp http://127.0.0.1:4000/ > ProxyPassReverse /myapp/ http://127.0.0.1:4000/ > ProxyPassReverse /myapp http://127.0.0.1:4000/ > ======> > And there''s following like in Apache''s httpd.conf > > Include conf/httpd-webrick-proxy.conf > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Mongrel-users mailing list > Mongrel-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-users
I''m assuming all of your configuration below is *not* in a VirtualHost block? If so, what''s the value of your ServerName directive? It should read: ServerName mymachinename I know the same ProxyPass and ProxyPassReverse directives (with the proper ServerName) work if you put it in a VirtualHost block, but I''m not entirely sure otherwise. -Ripta> Alias /myapp "c:/rails/myapp/public" > Alias /images "c:/rails/myapp/public/images" > Alias /stylesheets "c:/rails/myapp/public/stylesheets" > Alias /javascripts "c:/rails/myapp/public/javascripts" > <Directory "c:/rails/myapp/public"> > Options Indexes FollowSymLinks > AllowOverride none > Order allow,deny > Allow from all > </Directory> > > ProxyPass /images ! > ProxyPass /stylesheets ! > ProxyPass /javascripts ! > ProxyPass /myapp/ http://127.0.0.1:4000/ > ProxyPass /myapp http://127.0.0.1:4000/ > ProxyPassReverse /myapp/ http://127.0.0.1:4000/ > ProxyPassReverse /myapp http://127.0.0.1:4000/ > ======> > And there''s following like in Apache''s httpd.conf > > Include conf/httpd-webrick-proxy.conf-- Posted via http://www.ruby-forum.com/.
We had something similar in Apache when proxying twice (slightly odd internal architecture). We to brute-force the Host: header in my site''s httpd.conf: RequestHeader set Host railsapp.example.com And, as others have suggested, make sure your ServerName directive is set properly. -Nate On Nov 7, 2007, at 11:51 AM, Cynthia Kiser wrote:> Your Rails code looks fine and should give you normal urls as far as I > can see. I am afraid I don''t use ProxyPass and Directory directives; I > use mod_rewrite + VirtualHost stanzas. So I hope someone else on the > list can see what is funky. > > At a glance, this stanza looks fairly normal - though I haven''t see > folks do /myapp and /images in parallel. Is your Rails site a > subsection of another site?
Nothing worked! But the solution was somewhere else...It took me 4 hours to find that I had to change BASE_URL in my ''reverse_proxy_fix'' plugin from http://localhost/myapp to http://mymachinename/myapp :S Gotta get some sleep -- Posted via http://www.ruby-forum.com/.