You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2020/11/05 21:47:44 UTC

[sling-org-apache-sling-app-cms] 02/04: Making the proxied URLs configurable

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit 983d57f027dd6e4a5e14875c015f61491a244652
Author: Dan Klco <dk...@apache.org>
AuthorDate: Thu Nov 5 16:46:02 2020 -0500

    Making the proxied URLs configurable
---
 docker/docker-compose.yml                          |  6 +++++-
 docker/webcache/cms.conf                           |  5 +++--
 docker/webcache/site.conf                          | 10 ++++++----
 helm/slingcms-standalone/templates/deployment.yaml |  5 +++++
 4 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml
index a50a1c1..1c75929 100644
--- a/docker/docker-compose.yml
+++ b/docker/docker-compose.yml
@@ -30,7 +30,11 @@ services:
     volumes:
       - sling-renderer:/opt/slingcms/launcher/composite/repository-global
   webcache:
-    build: webcache
+    environment: 
+      AUTHOR_URL: author
+      RENDERER_URL: renderer
+    build: 
+      context: webcache
     ports:
       - "80:80"
 volumes:
diff --git a/docker/webcache/cms.conf b/docker/webcache/cms.conf
index f0af36e..b0accd1 100644
--- a/docker/webcache/cms.conf
+++ b/docker/webcache/cms.conf
@@ -17,7 +17,8 @@
    ErrorLog /var/log/apache2/sling-cms-err.log
    TransferLog /var/log/apache2/sling-cms-access.log
 
+   ProxyPassInterpolateEnv On
    ProxyPass /.well-known !
-   ProxyPass / http://author:8080/
-   ProxyPassReverse / http://author:8080/
+   ProxyPass / http://${AUTHOR_URL}:8080/ interpolate
+   ProxyPassReverse / http://${AUTHOR_URL}:8080/ interpolate
 </VirtualHost>
diff --git a/docker/webcache/site.conf b/docker/webcache/site.conf
index 1949259..549cc95 100644
--- a/docker/webcache/site.conf
+++ b/docker/webcache/site.conf
@@ -17,6 +17,7 @@
    DocumentRoot /var/www/vhosts/sling
    ErrorLog /var/log/apache2/sling-err.log
    TransferLog /var/log/apache2/sling-access.log
+   DirectoryIndex index.html
 
    # Configure mod_cache
    CacheEnable disk /
@@ -37,12 +38,13 @@
    ExpiresByType application/javascript "access plus 1 month"
 
    # Configure Proxy
+   ProxyPassInterpolateEnv On
    ProxyPass /.well-known !
    ProxyPass /ERROR !
-   ProxyPass /static/clientlibs/reference/ http://renderer:8080/static/clientlibs/reference/ connectiontimeout=10 timeout=60 retry=0
-   ProxyPassReverse /static/clientlibs/reference/ http://renderer:8080/static/clientlibs/reference/
-   ProxyPass / http://renderer:8080/content/apache/sling-apache-org/ connectiontimeout=10 timeout=60 retry=0
-   ProxyPassReverse /content/apache/sling-apache-org/ http://renderer:8080/content/apache/sling-apache-org/
+   ProxyPass /static/clientlibs/reference/ http://${RENDERER_URL}:8080/static/clientlibs/reference/ connectiontimeout=10 timeout=60 retry=0 interpolate
+   ProxyPassReverse /static/clientlibs/reference/ http://${RENDERER_URL}:8080/static/clientlibs/reference/ interpolate
+   ProxyPass / http://${RENDERER_URL}:8080/content/apache/sling-apache-org/ connectiontimeout=10 timeout=60 retry=0 interpolate
+   ProxyPassReverse /content/apache/sling-apache-org/ http://${RENDERER_URL}:8080/content/apache/sling-apache-org/ interpolate
 
    # Security / Hardening
    AllowEncodedSlashes on
diff --git a/helm/slingcms-standalone/templates/deployment.yaml b/helm/slingcms-standalone/templates/deployment.yaml
index 38ddc60..0857c30 100644
--- a/helm/slingcms-standalone/templates/deployment.yaml
+++ b/helm/slingcms-standalone/templates/deployment.yaml
@@ -68,6 +68,11 @@ spec:
             {{- toYaml .Values.securityContext | nindent 12 }}
           image: "{{ .Values.image.web.repository }}:{{ .Values.image.web.tag | default .Chart.AppVersion }}"
           imagePullPolicy: {{ .Values.image.web.pullPolicy }}
+          env:
+            - name: AUTHOR_URL
+              value: localhost
+            - name: RENDERER_URL
+              value: localhost
           ports:
             - name: http
               containerPort: 80