From 424569de13938b7de8b9722fc304fb7744466de3 Mon Sep 17 00:00:00 2001 From: Jan Lehnardt Date: Tue, 16 Nov 2010 10:55:25 +0000 Subject: After authentication, redirect to the path the user requested, not the one that is used internally. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1035581 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index dea41eeb..4bce7e02 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -773,7 +773,13 @@ error_headers(#httpd{mochi_req=MochiReq}=Req, Code, ErrorStr, ReasonStr) -> {Code, []}; match -> AuthRedirectBin = ?l2b(AuthRedirect), - UrlReturn = ?l2b(couch_util:url_encode(MochiReq:get(path))), + % Redirect to the path the user requested, not + % the one that is used internally. + UrlReturnRaw = case MochiReq:get_header_value("x-couchdb-vhost-path") of + undefined -> MochiReq:get(path); + VHostPath -> VHostPath + end, + UrlReturn = ?l2b(couch_util:url_encode(UrlReturnRaw)), UrlReason = ?l2b(couch_util:url_encode(ReasonStr)), {302, [{"Location", couch_httpd:absolute_uri(Req, <