Make use of <<allow_headers>> option
Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/63af9339 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/63af9339 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/63af9339 Branch: refs/heads/master Commit: 63af9339f2a65125e2e14498e3b985b915115004 Parents: 9733d21 Author: ILYA Khlopotov <[email protected]> Authored: Mon Jan 25 13:05:47 2016 -0800 Committer: ILYA Khlopotov <[email protected]> Committed: Mon Jan 25 13:05:47 2016 -0800 ---------------------------------------------------------------------- src/chttpd_cors.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/63af9339/src/chttpd_cors.erl ---------------------------------------------------------------------- diff --git a/src/chttpd_cors.erl b/src/chttpd_cors.erl index b7031e5..81cd475 100644 --- a/src/chttpd_cors.erl +++ b/src/chttpd_cors.erl @@ -110,6 +110,10 @@ handle_preflight_request(Req, Config, Origin) -> SupportedMethods = get_origin_config(Config, Origin, <<"allow_methods">>, ?SUPPORTED_METHODS), + SupportedHeaders = get_origin_config(Config, Origin, + <<"allow_headers">>, ?SUPPORTED_HEADERS), + + %% get max age MaxAge = couch_util:get_value("max_age", Config, ?CORS_DEFAULT_MAX_AGE), @@ -135,7 +139,7 @@ handle_preflight_request(Req, Config, Origin) -> {Headers, RH} end, %% check if headers are supported - case ReqHeaders -- ?SUPPORTED_HEADERS of + case ReqHeaders -- SupportedHeaders of [] -> PreflightHeaders = PreflightHeaders0 ++ [{"Access-Control-Allow-Headers",
