Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 {
      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 { }



Can anyone point me in the right direction?



share|improve this question
I try the same configuration in nginx 0.8 and it works fine: everything with the "build" string is passing without authentication. What happens when you deactivate "/" location? Is the build url working? – HD. Apr 30 '10 at 17:35
So I was doing a little digging and now I think this might be a permissions thing - have you chmod-ed you Hudson build dir (or anything similar)? – rodreegez May 4 '10 at 10:47
up vote 0 down vote accepted

The second location should be:

  location ~ \/build { 
          auth_basic off;
          proxy_pass http://hudson/;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.