Originally created by: rferreira-itav
I've been having a problem where repositories in an Allura instance failed to refresh after a git or svn commit was pushed into the repository. It turns out that the curl call in the repository hooks was hitting an HTTP redirect which caused it to never call the /auth/repo_refresh/ API.
Here is a detailed walkthrough.
Whenever a commit is pushed, a hook invokes curl to do a refresh, e.g.
Notice that this particular URL starts with a double slash (//). This happened because the base_url option in the settings file had a trailing slash i.e.
base_url = http://staging.hostname.com/
Since the hook generators in ForgeGit/forgegit/model/git_repo.py and ForgeSVN/forgesvn/model/svn.py generate the URL by appending the path to the base_url
url=tg.config.get('base_url', 'http://localhost:8080') + '/auth/refresh_repo' + self._repo.url())
the URL path will start with a double slash(//).
This will cause the webserver to return a 301 redirect with a fixed path
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>301 Moved Permanently</title> </head><body> <h1>Moved Permanently</h1> <p>The document has moved <a href="http://staging.hostname.com/auth/refresh_repo/p/test/code/">here</a>.</p> </body></html>
This will cause curl to immediately stop, because curl does not follow redirects by default.
A couple of solutions come to mind, but I don't know if the current behaviour is intentional or not, so they might not make sense:
Like I said, I don't know if the current behaviour (no redirects) is intentional or not, but at least (3.) would easily avoid trailing slash issues.
Hope this helps, cheers.
Log in to post a comment.