From 1a2340e4c09c5ee2aedc18f9f9f278dd1ee06b30 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 18 Oct 2021 21:45:18 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Proxy=20the=20frontend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proxy/httpd.conf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/proxy/httpd.conf b/proxy/httpd.conf index 8108b64..6268a68 100644 --- a/proxy/httpd.conf +++ b/proxy/httpd.conf @@ -560,12 +560,18 @@ ProxyPreserveHost on # Pass the base domain from the environment PassEnv "APACHE_PROXY_BASE_DOMAIN" -# Pass the sophon backend image name from the environment +# Pass the sophon backend and frontend image name from the environment PassEnv "SOPHON_BACKEND_NAME" +PassEnv "SOPHON_FRONTEND_NAME" -# Proxy regular requests to the backend -# sophon.steffo.eu → backend +# Proxy regular requests to the frontend +# sophon.steffo.eu → frontend RewriteCond "%{HTTP_HOST}" "^${ENV:APACHE_PROXY_BASE_DOMAIN}$" [NC] +RewriteRule "/(.*)" "http://${ENV:SOPHON_FRONTEND}/$1" [P,L] + +# Proxy api requests to the backend +# api.sophon.steffo.eu → backend +RewriteCond "%{HTTP_HOST}" "^api.${ENV:APACHE_PROXY_BASE_DOMAIN}$" [NC] RewriteRule "/(.*)" "http://${ENV:SOPHON_BACKEND_NAME}/$1" [P,L] # Create a map between the proxy file generated by Sophon and Apache