>
> 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.
>
> I've gone through the code and found a few instances where this
> happens - mostly in session_controller, users_controller and
> merge_requests_controller. Would it be possible to change this to be
> a configurable value via gitorious.yml? I didn't want to post a patch
> because I'm not sure if there are other instances yet where gitorious
> assumes that it's running out of '/' on the site - I only really did
> this to the obvious instances and then added a 'gitorious_url' to the
> gitorious.yml file.
>
> If those really are the *only* places, I can submit the patches up -
> wasn't sure on the name of the config variable either but I couldn't
> think of anything better to call it. :) Maybe gitorious_urlroot
One problem is that the CSS-files contains tons of references to
images found in "/images". Not sure what the best way to deal with
those are, but I'm sure it could be done.
There was a fork of Gitorious that did something similar, I can't
remember the exact name right now. That was for the old version of
Gitorious however, and might not work very well anymore. But maybe you
could get some ideas.
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