From 97724e03eacd463a68509ec35168f1b2a22c5d16 Mon Sep 17 00:00:00 2001 From: zepatrik Date: Wed, 26 Jun 2024 13:16:45 +0200 Subject: [PATCH] fix: tunnel setup --- .github/workflows/test.yml | 1 + cmd/cloudx/proxy/helpers.go | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 001c7839..8079bcbe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,6 +24,7 @@ jobs: ./ory proxy https://ory-network-httpbin-ijakee5waq-ez.a.run.app --quiet --rewrite-host & npm run test env: + ORY_API_KEY: placeholder ORY_PROJECT_SLUG: affectionate-archimedes-s9mkjq77k0 ORY_CONSOLE_URL: https://console.staging.ory.dev ORY_ORYAPIS_URL: https://staging.oryapis.dev diff --git a/cmd/cloudx/proxy/helpers.go b/cmd/cloudx/proxy/helpers.go index 2f7761d2..a308d286 100644 --- a/cmd/cloudx/proxy/helpers.go +++ b/cmd/cloudx/proxy/helpers.go @@ -134,9 +134,14 @@ func runReverseProxy(ctx context.Context, h *client.CommandHelper, stdErr io.Wri mw.UseFunc(sessionToJWTMiddleware(conf, writer, key, signer, oryURL)) // This must be the last method before the handler } - upstream, err := url.ParseRequestURI(conf.upstream) - if err != nil { - return errors.Wrap(err, "unable to parse upstream URL") + var upstream *url.URL + if conf.upstream != "" { + upstream, err = url.ParseRequestURI(conf.upstream) + if err != nil { + return errors.Wrap(err, "unable to parse upstream URL") + } + } else { + upstream = oryURL } mw.UseHandler(proxy.New(