On 3. juni. 2009, at 19.06, Steve Hajducko wrote:
>
> We installed gitorious on a system where we have several other rails
> apps running and I've got it running in a mongrel+apache setup with
> mod_proxy.
>
> The problem we're running into is that we run the app as
> http://host.example.com/git/
> - We've found is that there are certain times when gitorious redirects
> the user back to /, which ends up being some other site rather than
> the app.
Did you tell Rails about the sub uri you're using? You can do this in
your environment file (config/environments/<rails_env>.rb) like so:
config.action_controller.relative_url_root = "/git"
This way, Rails knows that you're running Gitorious on a sub uri and
will adapt its route generation and helper methods to accommodate
this. For instance, the stylesheet_link_tag and image_tag helpers will
prepend "/git" to any css/image references it makes, and the routing
will do the same. Same goes for javascripts.
Once this is done, Gitorious should work in most cases, with a few
exceptions:
- Whenever there's a redirect_to "/" - this is sloppyness on our
behalf, sorry. I actually didn't find that many references to such
redirections, but luckily Rails supplies a special route for this:
root_path (and root_url). So whenever there's a:
redirect_to "/"
this should be changed to
redirect_to root_url
No need for a special gitorious_root_path, as this is already built
into Rails. We'd really appreciate a patch if you find the time to do
this!
As for image/css references, these should be okay wherever the
image_tag and stylesheet_link_tag are used. Image references inside
your CSS files, however, are a different issue, as these are static
files without any knowledge of the actual URL schemes used by
Gitorious. You could create a script that changes image references in
the CSS file to their correct location, however this would probably be
a tedious and error-prone process. Another solution would be to use
URL rewriting to intercept requests for images included in
stylesheets. This, however, would need to be done on the root of your
web servers, as this is where the requests will be handled. If you
create a rewrite rule that matches /images/* for files that don't
exist in the file system, these URLs could be rewritten to "/git/
images/*".
Regards,
- Marius
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Gitorious" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/gitorious?hl=en
-~----------~----~----~----~------~----~------~--~---