How to allow Hudson build URL through Nginx auth_basic?

Posted by rodreegez on Server Fault See other posts from Server Fault or by rodreegez
Published on 2010-04-30T11:26:19Z Indexed on 2010/04/30 11:28 UTC
Read the original article Hit count: 180

Filed under:
|

Hi,

I have Hudson running and made available to the world via nginx. I have protected Hudson with nginx's auth_basic and that works great. The trouble is, I want to allow unauthenticated requests to the build URL, i.e. /job/<job_name>/build.

Currently I have this in my nginx conf:

upstream hudson {
    server 127.0.0.1:8888;
}

server {
      server_name     ci.myurl.com;
      root            /var/lib/hudson;

      location / {
              proxy_pass http://hudson/;

              auth_basic "Super secret stuff";
              auth_basic_user_file /var/opt/hudson/htpasswd;

      }

      location ~ \/build { 
              auth_basic off;
      }       
  }

I can't get that second location to allow unauthenticated requests. I have tried various combinations of

location ~ /job/(.*)/biuld { }

location ^~ \/build { }

location ~ \/job\/(.*)\/build { }

etc...

Maddening!

Can anyone point me in the right direction?

Thanks,

Ad.

© Server Fault or respective owner

Related posts about hudson

Related posts about nginx