From 7ccab9b164b008c32b4a35cd9524241c66069020 Mon Sep 17 00:00:00 2001 From: Jason David Davies Date: Fri, 2 Oct 2009 15:35:53 +0000 Subject: Add OAuth support for "https" URL scheme when using SSL proxy. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@821059 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_httpd.erl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/couchdb/couch_httpd.erl') diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index ac9ec723..b4e8793b 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -273,7 +273,18 @@ absolute_uri(#httpd{mochi_req=MochiReq}, Path) -> end; Value -> Value end, - "http://" ++ Host ++ Path. + XSsl = couch_config:get("httpd", "x_forwarded_ssl", "X-Forwarded-Ssl"), + Scheme = case MochiReq:get_header_value(XSsl) of + "on" -> "https"; + _ -> + XProto = couch_config:get("httpd", "x_forwarded_proto", "X-Forwarded-Proto"), + case MochiReq:get_header_value(XProto) of + % Restrict to "https" and "http" schemes only + "https" -> "https"; + _ -> "http" + end + end, + Scheme ++ "://" ++ Host ++ Path. unquote(UrlEncodedString) -> mochiweb_util:unquote(UrlEncodedString). -- cgit v1.2.3