1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 06:44:21 +00:00

🔧 Proxy the frontend

This commit is contained in:
Steffo 2021-10-18 21:45:18 +02:00
parent 36b1dbbfd2
commit 1a2340e4c0

View file

@ -560,12 +560,18 @@ ProxyPreserveHost on
# Pass the base domain from the environment # Pass the base domain from the environment
PassEnv "APACHE_PROXY_BASE_DOMAIN" 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_BACKEND_NAME"
PassEnv "SOPHON_FRONTEND_NAME"
# Proxy regular requests to the backend # Proxy regular requests to the frontend
# sophon.steffo.eu → backend # sophon.steffo.eu → frontend
RewriteCond "%{HTTP_HOST}" "^${ENV:APACHE_PROXY_BASE_DOMAIN}$" [NC] 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] RewriteRule "/(.*)" "http://${ENV:SOPHON_BACKEND_NAME}/$1" [P,L]
# Create a map between the proxy file generated by Sophon and Apache # Create a map between the proxy file generated by Sophon and Apache