svn repository doesn't use the 'Force Base Url' directive

Issue #374 resolved
mastah naleh created an issue

Set 'Force Base Url' to

For example if you have the application under and reverse proxy to http://localhost:8080/scm/ all url will be rewrite for expect the svn repositories that will look like : "" instead of ""

It's 'probably' a matter of using the same code defining exposed url.

Comments (16)

  1. mastah naleh reporter

    To add more information. To reproduce this bug you need to be behind a reverse proxy and change base URL to something like with no path behind the root (so no /scm-manager/ or anything).

  2. mastah naleh reporter

    War version.

    If needed I can also try on the standalone version. But so far I think It will do the same (I've tried the standalone, but not behind a reverse proxy).

  3. mastah naleh reporter

    I've did some debug on the 1.30 version and so far I believe it's svnkit using the basedoc of the app to create the svn html view of repositories. I'm not 100% sure, and maybe you can provide arguments to svnkit to tell him how to build urls.

  4. Sebastian Sdorra repo owner

    I've checked the sources of svnkit-dav, but there seems not argument to allow this. I could try to fix this by my self, but this would take a lot of time. As a workaround you can change the context path of scm-manager in your application server.

  5. StephanO

    I had the same issue with the war version and GIT. I changed the tomcat configuration and added the host to tomcat (server.xml). I also switched to mod_proxy_ajp which works fine for me

    ProxyPass / ajp://localhost:8009 ProxyPassReverse / ajp://localhost:8009

    Now it works like a charm.

  6. mastah naleh reporter

    Stephan, that's not part of the problem here, I think (that's an other issue with wrong done reverse proxy). The problem here is when the application is not deployed on tomcat (for example) as a root application (so instead of / it's deployed as /scm). Under those condition, the list of files created by svnkit use, not matter if you configure 'force base url', the root context which is /scm in my case.

    That mean that even if the reverse is done correctly, the list of file will all have '/scm/svn/'... Of course if I manually remove the '/scm' I can access to the files. But a tools like SVNtigirs or subversion can't do that on their own. So it's just a matter of having svnkit following the 'force base url' rule.

    I'm not sure if it's possible though.

  7. mastah naleh reporter

    I've identified what's need to be done in order for that to work.

    In the class SvnDAVServlet, from the project scm-svn-plugin, you need to add to the inner class SvnHttpServletRequestWrapper the method "public String getContextPath()".

    In this method, you'll have to retrieve the 'force based url' and get the context from this one if the direct 'Force base url' is set to true. Since the configuration for the 'Force base url' is in the project scm-webapp, you'll need to somehow inject the 'force base url' and isForceBaseUrl information into the scm-svn-plugin. After that, it's just a matter of returning the context path from the 'Force base url' context value or super.getContextPath() if the directive is not set.

    I've tried to override the getContextPath() and it's working properly. Since I didn't do the whole part of retrieving the configuration, I've just set what I needed to be set in order to test.

    This only fix the problem with svn and probably not with Git nor with HG.

  8. mastah naleh reporter

    The getContextPath could look like

        public String getContextPath() {
            if (!isForceBaseUrl) return super.getContextPath();
            else return "contextFromForceBaseUrl";
  9. Sebastian Sdorra repo owner

    I'm not sure if this is enough, because we have to check if svnkit-dav call request.getRequestURL() or request.getRequestURI(). Git and HG are no problems, because the request bodies does not contain any path informations.

    But the main problem is that "force base url" should never be used with a reverse proxy, because it ends in a redirect loop. A better approach would be a header from the reverse proxy which contains the original url. I'm not sure if it possible to create such a header with the common reverse proxies (nginx, apache, etc...).

  10. mastah naleh reporter

    I think you can do that with nginx, and actually it's what my setting is doing. I'm not sure if contextPath taken from tomcat by svnkit as any clue that tomcat need to take the reversed proxy url instead of making his own.

    In the mean time, I've found that nginx can "edit" the content of body. I don't really like the solution of editing the whole body to fix the contextPath at nginx level. cf.

  11. tech darr

    Hey guys i need some help i installed SCM Manager and i set the base url to an incorrect url so i cannot access the application can someone please tell me how i access the save settings to change it back to the default

  12. Log in to comment