zonemaster-gui/zonemaster.conf-example
2026-02-10 13:23:07 +01:00

57 lines
1.8 KiB
Text

<VirtualHost *:80>
# BASE_URL can be set and DEFAULT_LANGUAGE can be updated.
# Uncomment the following line *only* if the GUI is served from a
# subdirectory. The setting here must match the setting in config.ts.
# Must start with a slash, but not end with a slash.
# Define BASE_URL "/subdirectory" # Undefined by default
# Default language must be updated if "defaultLanguage" in config.ts is
# changed. Both must match.
Define DEFAULT_LANGUAGE "en"
# Nothing to set or update below. #
DirectoryIndex index.html
<IfDefine BASE_URL>
Alias ${BASE_URL} /var/www/html/zonemaster-web-gui/dist
Define API_BASE_URL "${BASE_URL}/api"
</IfDefine>
<IfDefine !BASE_URL>
DocumentRoot /var/www/html/zonemaster-web-gui/dist
Define API_BASE_URL "/api"
</IfDefine>
<Directory /var/www/html/zonemaster-web-gui/dist>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
RewriteEngine On
<IfDefine BASE_URL>
RewriteBase ${BASE_URL}/
</IfDefine>
RewriteRule ^$ /${DEFAULT_LANGUAGE} [R]
# Rewrite /result/{anything} to {default_language}/result/id/index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^result/[^/]+/?$ ${DEFAULT_LANGUAGE}/result/id/index.html [L]
# Rewrite /{lang}/result/{anything} to /{lang}/result/id/index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/result/[^/]+/?$ $1/result/id/index.html [L]
</Directory>
<Location "${API_BASE_URL}">
ProxyPass http://localhost:5000/
ProxyPassReverse http://localhost:5000/
ProxyPreserveHost On
</Location>
</VirtualHost>