Forum: Ruby on Rails URL issue localhost/mongrel vs remote-server/apache

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Kad K. (Guest)
on 2009-04-06 11:23
(Received via mailing list)
Hi all

I have a small issue I ma trying to solve (at least to understand..)

I am testing an app on my remote_server (w Apache/Passenger) in a
sub_URI, without any problem  (I tested also the same app, locally w
Apache too)
in my environment.rb , I have initialized
  config.action_controller.relative_url_root = "/my_subURI"
  config.action_controller.asset_host = "http://my_domain.com
...
running fine. I am also using a facebox plugin, in which 2 images :
loading.gif and closelabel.gif are hard-coded (I know it should not
be.. but I am not the author..), so in the facebox.js , I had to
modify the hard-coded URI
  $.extend($.facebox, {
    settings: {
      loadingImage : '/my_subURIv/images/facebox/loading.gif',
      closeImage   : '/my_subURI/images/facebox/closelabel.gif',
...
without this modification, the images where not found.... (don't
understand why ..)

the issue is now when running  local in development/test, using
Mongrel, teh app is running fine too, EXCEPTED these 2 images :  I got
the message when displaying the facebox form

ActionController::RoutingError (No route matches "/images/facebox/
closelabel.gif" with {:method=>:get}):

I don't know if there is any possibility to avoid this issue, testing
the host (localhost) and changing the environment definition only when
running on localhost ? or any other trick ???

thanks for any ino or link on this kind of issue

erwin
Kad K. (Guest)
on 2009-04-06 11:58
(Received via mailing list)
one solution could be not modifying the facebox js  URIs, keeping as
it :

>       loadingImage : '/images/facebox/loading.gif',
>       closeImage   : '/images/facebox/closelabel.gif',

which presently raises an error when running w Apache-passenger (no
subURI)  and

just rewriting all  http://my_domain.com/images/ TO
http://my_domain.com/my_subURI/images

is that a trick or the solution ?  (in which case, not being an
Apache's guru .. how should I rewrite it in an .htaccess

 any enlightments ?

erwin
Kad K. (Guest)
on 2009-04-06 17:07
(Received via mailing list)
I discover the prefix option for Mongrel ....

so starting on localhost

script/server -u -P /my_subURI

is the trick...   then it's running as w Apache-passenger ....


erwin
This topic is locked and can not be replied to.