From 40a6348e7c0c07f5f7cd15df1a43a78e7aee09f5 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 5 Jan 2021 18:47:51 +0000 Subject: [PATCH] Version working with reverse proxy, need to just change settings menu in builder now to use this properly. --- hosting/docker-compose.yaml | 2 +- hosting/envoy.yaml | 31 ++++++++++++++++++++++--------- packages/client/src/api/api.js | 3 ++- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/hosting/docker-compose.yaml b/hosting/docker-compose.yaml index 184e340ce4..cf86d3cd98 100644 --- a/hosting/docker-compose.yaml +++ b/hosting/docker-compose.yaml @@ -42,7 +42,7 @@ services: volumes: - data1:/data ports: - - "9000:9000" + - "${MINIO_PORT}:9000" environment: MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} diff --git a/hosting/envoy.yaml b/hosting/envoy.yaml index f9bbc49025..a6b110428e 100644 --- a/hosting/envoy.yaml +++ b/hosting/envoy.yaml @@ -13,7 +13,7 @@ static_resources: - name: envoy.filters.network.http_connection_manager typed_config: "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager - stat_prefix: ingress_http + stat_prefix: ingress codec_type: auto route_config: name: local_route @@ -21,14 +21,27 @@ static_resources: - name: local_services domains: ["*"] routes: - - match: { prefix: "/app" } - route: { cluster: app-service } - - match: { prefix: "/obj" } - route: { cluster: minio-service } - - match: { prefix: "/worker" } - route: { cluster: worker-service } - - match: { prefix: "/db" } - route: { cluster: couchdb-service } + - match: { prefix: "/app/" } + route: + cluster: app-service + prefix_rewrite: "/" + + - match: { prefix: "/worker/" } + route: + cluster: worker-service + prefix_rewrite: "/" + + - match: { prefix: "/db/" } + route: + prefix_rewrite: "/" + cluster: couchdb-service + + # minio is on the default route because this works + # best, minio + AWS SDK doesn't handle path proxy + - match: { prefix: "/" } + route: + cluster: minio-service + http_filters: - name: envoy.filters.http.router diff --git a/packages/client/src/api/api.js b/packages/client/src/api/api.js index ea88787865..c339bf8ac6 100644 --- a/packages/client/src/api/api.js +++ b/packages/client/src/api/api.js @@ -9,7 +9,8 @@ let cache = {} * Makes a fully formatted URL based on the SDK configuration. */ const makeFullURL = path => { - return `/${path}`.replace("//", "/") + const isProxy = window.location.pathname.startsWith("/app/") + return `${isProxy ? "/app/" : "/"}${path}`.replace("//", "/") } /**