danielszot opened a new issue #1982: Error 500 when no basic auth credentials 
passed
URL: https://github.com/apache/couchdb/issues/1982
 
 
   I get 500 HTTP error response when I try to request anything without basic 
auth credentials passed by URL.
   
   ## Steps to Reproduce
   
   Request without credentials: `curl localhost:5948/_up -v`
   Incorrect response:
   ```
   * TCP_NODELAY set
   * Connected to localhost (::1) port 5948 (#0)
   > GET /_up HTTP/1.1
   > Host: localhost:5948
   > User-Agent: curl/7.54.0
   > Accept: */*
   > 
   < HTTP/1.1 500 Internal Server Error
   < Cache-Control: must-revalidate
   < Content-Length: 58
   < Content-Type: application/json
   < Date: Mon, 18 Mar 2019 11:11:41 GMT
   < Server: CouchDB/2.3.0 (Erlang OTP/19)
   < X-Couch-Request-ID: 0f85ee75b9
   < X-Couch-Stack-Hash: 2393520390
   < X-CouchDB-Body-Time: 0
   < 
   {"error":"case_clause","reason":"False","ref":2393520390}
   * Connection #0 to host localhost left intact
   ```
   
   Request with bad credentials: `curl bad_user:bad_pass@localhost:5948/_up -v`
   Correct response (consistent with the docs):
   ```
   * TCP_NODELAY set
   * Connected to localhost (::1) port 5948 (#0)
   * Server auth using Basic with user 'a'
   > GET /_up HTTP/1.1
   > Host: localhost:5948
   > Authorization: Basic YTph
   > User-Agent: curl/7.54.0
   > Accept: */*
   > 
   < HTTP/1.1 401 Unauthorized
   < Cache-Control: must-revalidate
   < Content-Length: 67
   < Content-Type: application/json
   < Date: Mon, 18 Mar 2019 11:11:17 GMT
   < Server: CouchDB/2.3.0 (Erlang OTP/19)
   < X-Couch-Request-ID: 8fa0cea019
   < X-CouchDB-Body-Time: 0
   < 
   {"error":"unauthorized","reason":"Name or password is incorrect."}
   * Connection #0 to host localhost left intact
   ```
   
   Request with correct credentials: `curl 
correct_user:correct_pass@localhost:5948/_up -v`
   Correct response (consistent with the docs):
   ```
   * TCP_NODELAY set
   * Connected to localhost (::1) port 5948 (#0)
   * Server auth using Basic with user 'correct_user'
   > GET /_up HTTP/1.1
   > Host: localhost:5948
   > Authorization: Basic ***
   > User-Agent: curl/7.54.0
   > Accept: */*
   > 
   < HTTP/1.1 200 OK
   < Cache-Control: must-revalidate
   < Content-Length: 27
   < Content-Type: application/json
   < Date: Mon, 18 Mar 2019 11:10:28 GMT
   < Server: CouchDB/2.3.0 (Erlang OTP/19)
   < X-Couch-Request-ID: 6375e9098e
   < X-CouchDB-Body-Time: 0
   < 
   {"status":"ok","seeds":{}}
   * Connection #0 to host localhost left intact
   ```
   
   ## Expected Behaviour
   
   Request without credentials: `curl localhost:5948/_up -v`
   Expected response:
   ```
   ...
   < HTTP/1.1 401
   ...
   {"error":"unauthorized","reason":"You are not a server admin."}
   ```
   
   ## Your Environment
   
   Ini file put to the /opt/couchdb/etc/default.d (ConfigMap as a source for 
volume of configMap type mounted to the container in given path):
   ```ini
   [cluster]
   q = 9
   n = 2
   [chttpd]
   bind_address = any
   require_valid_user = False
   ```
   
   `curl correct_user:correct_pass@localhost:5948/ | jq` response:
   ```json
   {
     "couchdb": "Welcome",
     "version": "2.3.0",
     "git_sha": "07ea0c7",
     "uuid": "9720f1c415e1674e4a6c5448dc093242",
     "features": [
       "pluggable-storage-engines",
       "scheduler"
     ],
     "vendor": {
       "name": "The Apache Software Foundation"
     }
   }
   ```
   
   * CouchDB Version used: 2.3.0
   * Browser name and version: curl/7.54.0
   * Operating System and version: Ubuntu 18.04
   
   ## Additional context
   
   CouchDB 2.3.0 working in 3 nodes cluster inside Kubernetes cluster. Host OS 
of Kubernetes nodes is Ubuntu 18.04. Data volumes are mounted to the containers 
as PersistentVolumes, storage behind a dedicated storage class is local disk.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to