From 540a96be9ad75e50297e77d0aec93265998632b6 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 31 May 2024 18:04:44 +0000 Subject: [PATCH] Add proxying settings (#7) Reviewed-on: https://git.vdb.to/cerc-io/din-payments-stack/pulls/7 --- .../compose/docker-compose-nitro-auth.yml | 1 + .../config/nitro-auth/alice.env | 2 +- .../config/nitro-auth/caddy/Caddyfile | 25 ++++++++++++++++--- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/stack-orchestrator/compose/docker-compose-nitro-auth.yml b/stack-orchestrator/compose/docker-compose-nitro-auth.yml index 151a833..8a3eeb1 100644 --- a/stack-orchestrator/compose/docker-compose-nitro-auth.yml +++ b/stack-orchestrator/compose/docker-compose-nitro-auth.yml @@ -43,6 +43,7 @@ services: environment: CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK_BOB:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597} CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546} + CERC_NITRO_GETH_HTTP_URL: ${CERC_NITRO_GETH_HTTP_URL:-http://fixturenet-eth-geth-1:8545} CERC_NA_ADDRESS: ${CERC_NA_ADDRESS} CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS} CERC_CA_ADDRESS: ${CERC_CA_ADDRESS} diff --git a/stack-orchestrator/config/nitro-auth/alice.env b/stack-orchestrator/config/nitro-auth/alice.env index 2de2a01..2e5424a 100644 --- a/stack-orchestrator/config/nitro-auth/alice.env +++ b/stack-orchestrator/config/nitro-auth/alice.env @@ -16,4 +16,4 @@ CERC_NITRO_MSG_PORT=3006 CERC_NITRO_RPC_PORT=4006 CERC_NITRO_UI_PORT=4106 CERC_NITRO_USE_DURABLE_STORE=true -CERC_NITRO_WS_MSG_PORT=5006 \ No newline at end of file +CERC_NITRO_WS_MSG_PORT=5006 diff --git a/stack-orchestrator/config/nitro-auth/caddy/Caddyfile b/stack-orchestrator/config/nitro-auth/caddy/Caddyfile index 04c8069..2762a49 100644 --- a/stack-orchestrator/config/nitro-auth/caddy/Caddyfile +++ b/stack-orchestrator/config/nitro-auth/caddy/Caddyfile @@ -3,8 +3,13 @@ reverse_proxy http://go-nitro-bob:8547 } + handle /nitro/pay* { + uri strip_prefix /nitro + reverse_proxy http://go-nitro-bob:8547 + } + @eth-key-in-header { - path_regexp /eth/?$ + path_regexp (/nitro)?/eth/?$ header X-Api-Key * } @@ -20,12 +25,12 @@ } @eth-key-in-path { - path_regexp apikey eth/(.+)$ + path_regexp apikey (/nitro)?/eth/(.+)$ } handle @eth-key-in-path { forward_auth go-nitro-bob:8547 { - uri /auth/{re.apikey.1} + uri /auth/{re.apikey.2} } rewrite * / reverse_proxy {$CERC_ETH_RPC_ENDPOINT} { @@ -34,8 +39,20 @@ } } + handle /nitro/eth { + rewrite * / + reverse_proxy go-nitro-bob:8547 { + header_up Host {upstream_hostport} + header_up -X-Forwarded-* + } + } + handle /eth* { - respond "401 Unauthorized" 401 + rewrite * / + reverse_proxy go-nitro-bob:8547 { + header_up Host {upstream_hostport} + header_up -X-Forwarded-* + } } handle /ts-nitro* {