2016-12-29 2 views
0

이것은 다소 이상합니다. 나는 couchdb 2.0에 사용자 데이터베이스를 업데이트하기 위해 전화를하고 "상태 = Referer 헤더가 호스트와 일치해야합니다."라는 401 상태 메시지를 반환합니다.aurelia 가져 오기 클라이언트를 사용하여 _user db에 400 상태 게시가있는 couchdb 응답

그러나 "게시"를 "넣기"로 변경하면 행복하며 예상대로 201 상태를 반환합니다. 계속 사용할 수 있지만 표준이 아닙니다.

제안 사항?

POST http://localhost:5984/_users/org.couchdb.user:test1 HTTP/1.1 
Host: localhost:5984 
Connection: keep-alive 
Content-Length: 364 
Pragma: no-cache 
Cache-Control: no-cache 
Origin: http://localhost:9000 
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 
content-type: application/json 
Accept: */* 
DNT: 1 
Referer: http://localhost:9000/ 
Accept-Encoding: gzip, deflate, br 
Accept-Language: en-US,en;q=0.8 
Cookie: io=YBMMIY0pejGjeHV9AACO; AuthSession=foo 

{ 
    "_id":"org.couchdb.user:test1", 
    "_rev":"1-8e2136e07f62238327f87d1ae54a29df", 
    "type":"user","roles": "user"], 
    "name":"test1", 
    "email":"[email protected]", 
    "fullName":"Test1 esq", 
    "phone":"555-555-5555", 
    "id":"org.couchdb.user:test1", 
    "password_scheme":"pbkdf2", 
    "iterations":10, 
    "derived_key":"0e076f6f85f1389fd90ff181d433e1438e8e30a4", 
    "salt":"37f590de042f07956f6cc11b8a9eb012" 
} 

응답

HTTP/1.1 400 Bad Request 
Access-Control-Allow-Credentials: true 
Access-Control-Allow-Origin: http://localhost:9000 
Access-Control-Expose-Headers: content-type, cache-control, accept-ranges, etag, server, x-couch-request-id, x-couch-update-newrev, x-couchdb-body-time 
Cache-Control: must-revalidate 
Connection: close 
Content-Length: 67 
Content-Type: application/json 
Date: Thu, 29 Dec 2016 23:15:25 GMT 
Server: CouchDB/2.0.0 (Erlang OTP/17) 
X-Couch-Request-ID: b45ec52b5c 
X-CouchDB-Body-Time: 0 

{"error":"bad_request","reason":"Referer header must match host."} 

**This works** 

PUT http://localhost:5984/_users/org.couchdb.user:test1 HTTP/1.1 
Host: localhost:5984 
Connection: keep-alive 
Content-Length: 364 
Pragma: no-cache 
Cache-Control: no-cache 
Origin: http://localhost:9000 
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36 
content-type: application/json 
Accept: */* 
DNT: 1 
Referer: http://localhost:9000/ 
Accept-Encoding: gzip, deflate, sdch, br 
Accept-Language: en-US,en;q=0.8 
Cookie: io=62j8pWngSUNyLwKjAACX; AuthSession=xyyz 

{ 
    "_id":"org.couchdb.user:test1", 
    "_rev":"1-8e2136e07f62238327f87d1ae54a29df", 
    "type":"user", 
    "roles":["user"], 
    "name":"test1", 
    "email":"[email protected]", 
    "fullName":"Test1 esq", 
    "phone":"555-555-5555", 
    "id":"org.couchdb.user:test1", 
    "password_scheme":"pbkdf2", 
    "iterations":10, 
    "derived_key":"0e076f6f85f1389fd90ff181d433e1438e8e30a4", 
    "salt":"37f590de042f07956f6cc11b8a9eb012" 
} 
+0

과 함께 X-Forwarded-Host 헤더를 배치 할 수 있습니다. Referer 헤더를 삭제할 수 있습니까? 너는 그것을 필요로 하느냐? – LStarky

+0

나는 그것을 시도하지 않았고 명시 적으로 추가하지 않고있는 방법을 잘 모르겠다. 정의되지 않은 채로 설정할 수는 있지만 개체에는 정의되어 있지 않습니다. 내가 보내지기 전에 그것을 피들러와 함께 헤더에서 제거하려고 노력할 것입니다. –

답변