Skip to content

Commit 91d904d

Browse files
committed
MB-47316 Add Xdcr proxy endpoints
This change proxies all xdcr/* requests (GET, POST, DELETE, PUT) to xdcr. Change-Id: If5ba23e2c634a6a243aa8fb25aeeac453316114a Reviewed-on: http://review.couchbase.org/c/ns_server/+/158121 Tested-by: Steve Watanabe <[email protected]> Tested-by: Neil Huang <[email protected]> Well-Formed: Build Bot <[email protected]> Reviewed-by: Abhijeeth Nuthan <[email protected]>
1 parent 6bbc2e5 commit 91d904d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/menelaus_web.erl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,10 @@ get_action(Req, {AppRoot, IsSSL, Plugins}, Path, PathTokens) ->
508508
XdcrPath = drop_prefix(mochiweb_request:get(raw_path, Req)),
509509
{{[admin, internal], all},
510510
fun goxdcr_rest:proxy/2, [XdcrPath]};
511+
["xdcr" | _RestPath] ->
512+
XdcrPath = mochiweb_request:get(raw_path, Req),
513+
{{[admin, internal], all},
514+
fun goxdcr_rest:proxy/2, [XdcrPath]};
511515
["_cbauth", "checkPermission"] ->
512516
{{[admin, internal], all},
513517
fun menelaus_web_rbac:handle_check_permission_for_cbauth/1};
@@ -862,6 +866,10 @@ get_action(Req, {AppRoot, IsSSL, Plugins}, Path, PathTokens) ->
862866
{{[{bucket, Bucket}, data, meta], read},
863867
fun menelaus_web_xdcr_target:handle_pre_replicate/2,
864868
[Bucket]};
869+
["xdcr" | _RestPath] ->
870+
XdcrPath = mochiweb_request:get(raw_path, Req),
871+
{{[admin, internal], all},
872+
fun goxdcr_rest:proxy/2, [XdcrPath]};
865873
["logClientError"] ->
866874
{no_check, fun log_client_error/1};
867875
["diag", "eval"] ->
@@ -959,6 +967,10 @@ get_action(Req, {AppRoot, IsSSL, Plugins}, Path, PathTokens) ->
959967
["couchBase",
960968
drop_prefix(mochiweb_request:get(raw_path, Req)),
961969
Plugins]};
970+
["xdcr" | _RestPath] ->
971+
XdcrPath = mochiweb_request:get(raw_path, Req),
972+
{{[admin, internal], all},
973+
fun goxdcr_rest:proxy/2, [XdcrPath]};
962974
["_metakv" | _] ->
963975
{{[admin, internal], all}, fun menelaus_metakv:handle_delete/2, [Path]};
964976
[?PLUGGABLE_UI, RestPrefix | _] ->
@@ -1007,6 +1019,9 @@ get_action(Req, {AppRoot, IsSSL, Plugins}, Path, PathTokens) ->
10071019
["couchBase",
10081020
drop_prefix(mochiweb_request:get(raw_path, Req)),
10091021
Plugins]};
1022+
["xdcr" | _RestPath] ->
1023+
XdcrPath = mochiweb_request:get(raw_path, Req),
1024+
{{[admin, internal], all}, fun goxdcr_rest:proxy/2, [XdcrPath]};
10101025
["_metakv" | _] ->
10111026
{{[admin, internal], all}, fun menelaus_metakv:handle_put/2, [Path]};
10121027
[?PLUGGABLE_UI, RestPrefix | _] ->

0 commit comments

Comments
 (0)