[Buildbot-devel] 'Add WebStatus authz "view" action.' and absolute vs relative paths for proxypass

Benjamin Andre bandre at lbl.gov
Wed Aug 14 02:31:54 UTC 2013


We host buildmasters for several projects on the same machine, and use
apache virtual host proxy pass:

<VirtualHost *:80>
    ProxyPass /proj1/ http://some.where.org:1234/
    ProxyPassReverse /proj1/ http://some.where.org:1234/
    ProxyPass /proj2/ http://some.where.org:1235/
    ProxyPassReverse /proj2/ http://some.where.org:1235/
</VirtualHost>

I just tried to add a new master using git master, and the paths for
the web pages are no longer correct. buildbot
git(05b7e733ce40a6d21568c8115f6e34ec03cc3e2f) generates the root page
so that URLs become

some.where.org/proj1/default.css

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Buildbot</title>
    <link rel="stylesheet" href="default.css" type="text/css" />
    <link rel="alternate" type="application/rss+xml" title="RSS" href="rss">
    <link rel="shortcut icon" href="favicon.ico">
      </head>
  <body class="interface">
    <div class="header">
        <a href=".">Home</a>
        - <a href="waterfall">Waterfall</a>
        <a href="grid">Grid</a>
        <a href="tgrid">T-Grid</a>
        <a href="console">Console</a>
        <a href="builders">Builders</a>
        <a href="one_line_per_build">Recent Builds</a>
        <a href="buildslaves">Buildslaves</a>
        <a href="changes">Changesources</a>
                - <a href="json/help">JSON API</a>
        - <a href="about">About</a>
    <div class="auth">
        <form method="post" name="login" action="login">
    <input type="text" name="username" size=10 />
    <input type="password" name="passwd" size=10 />
    <input type="submit" value="login" />
    </form>
        </div>
    </div>
    <hr/>

buildbot git(0ebd2051141932c892f9ef2115034001382a88d8) generates URLs like:

some.where.org/default.css

but should be:

some.where.org/proj2/default.css

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
            <title>Buildbot</title>
    <link rel="stylesheet" href="/default.css" type="text/css" />
    <link rel="alternate" type="application/rss+xml" title="RSS" href="/rss">
    <link rel="shortcut icon" href="/favicon.ico">
      </head>
  <body class="interface">
    <div class="header">
        <a href="/">Home</a>
                - <a href="/waterfall">Waterfall</a>
        <a href="/grid">Grid</a>
        <a href="/tgrid">T-Grid</a>
        <a href="/console">Console</a>
        <a href="/builders">Builders</a>
        <a href="/one_line_per_build">Recent Builds</a>
        <a href="/buildslaves">Buildslaves</a>
        <a href="/changes">Changesources</a>
                - <a href="/json/help">JSON API</a>
        - <a href="/about">About</a>
            <div class="auth">
        <form method="post" name="login" action="/login">
    <input type="text" name="username" size=10 />
    <input type="password" name="passwd" size=10 />
    <input type="submit" value="login" />
    </form>
        </div>
    </div>
    <hr/>

Notice all the hrefs now start with an absolute path "/".

This appears to be from 'Add WebStatus authz "view" action.',

https://github.com/buildbot/buildbot/commit/110cdfb24c52cc95af8ee620c66540a384c22596

master/buildbot/status/web/base.py:122

Is the new behavior the desired behavior? If so, what is the correct
way to work with proxypass? If not, the patch below fixes it for me,
but I don't know if it is universally correct.

Thanks,

Ben

$ git diff
diff --git a/master/buildbot/status/web/base.py b/master/buildbot/status/web/bas
index 8a268f2..add1679 100644
--- a/master/buildbot/status/web/base.py
+++ b/master/buildbot/status/web/base.py
@@ -119,7 +119,7 @@ def path_to_root(request):
     else:
         segs = 0
     root = "../" * segs
-    return root if len(root) > 0 else "/"
+    return root if len(root) > 0 else "./"

 def path_to_authfail(request):
     return path_to_root(request) + "authfail"




More information about the devel mailing list