Forum: NGINX Problem with auth_basic + proxy_pass + transmission-daemon

Posted by Mark Alan (Guest)
on 2013-02-23 22:12
(Received via mailing list)
Hello list,

While using nginx 1.3.12 + transmission-daemon 2.77 + Ubuntu 12.04,

# /etc/transmission-daemon/settings.json
    ...
    "rpc-bind-address": "127.0.0.1",
    "rpc-port": 9091,
    "rpc-url": "/transmission/",
    ...

ls -l /etc/nginx/.htpasswdtrans
   -rw-r----- 1 root www-data 64 ... /etc/nginx/.htpasswdtrans

Trying to browse to:  https://example.localdomain/transmission

WORKS IF:
  location /transmission {
    proxy_pass http://127.0.0.1:9091/transmission;
  }

DOES NOT WORK IF:
  location /transmission {
    auth_basic "Restricted Area";
    auth_basic_user_file .htpasswdtrans;
    proxy_pass http://127.0.0.1:9091/transmission;
  }

AND GIVES THESE ERRORS:
==> /var/log/nginx/access.log <==
  192.168.0.70 - - [23/Feb/2013:20:38:19 +0000] "POST /transmission/rpc
HTTP/1.1" 302 158 "https://example.localdomain/transmission/web/"
"Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:19.0) Gecko/20100101
Firefox/19.0" 192.168.0.70 - - [23/Feb/2013:20:38:19 +0000]
"{\x22method\x22:\x22session-get\x22}" 400 170 "-" "-"
  [error] 6012#0: *799 no user/password was provided for basic
authentication, client: 192.168.0.70, server: example.localdomain,
request: "GET /transmission/web/style/transmission/images/logo.png
HTTP/1.1", host: "example.localdomain", referrer:
"https://example.localdomain/transmission/web/style...

==> /var/log/nginx/error.log <==
  2013/02/23 20:38:19 [error] 6012#0: *799 no user/password was provided
for basic authentication, client: 192.168.0.70, server:
example.localdomain, request:
"GET /transmission/web/style/transmission/images/logo.png HTTP/1.1",
host: "example.localdomain", referrer:
"https://example.localdomain/transmission/web/style...

Note:
Adding the following to the 'location /transmission', or to the
parent server {} did not help:
  proxy_redirect off;
  proxy_set_header Host $http_host;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Real-IP  $remote_addr;


Any ideas on how to make 'auth_basic' work?

Thank you.

M.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.