mirror of
https://github.com/philippemerle/KubeDiagrams.git
synced 2026-05-06 09:06:33 +00:00
51 lines
1.7 KiB
ApacheConf
51 lines
1.7 KiB
ApacheConf
# =============================================================================
|
|
# Apache Configuration for KubeDiagrams Frontend
|
|
# =============================================================================
|
|
# - Serves static React files
|
|
# - Proxies /api/* requests to the backend
|
|
# - Handles SPA routing (React Router)
|
|
# - Forwards real client IP to backend
|
|
# =============================================================================
|
|
|
|
<VirtualHost *:80>
|
|
ServerAdmin webmaster@localhost
|
|
DocumentRoot /usr/local/apache2/htdocs
|
|
|
|
# Logs
|
|
ErrorLog /dev/stderr
|
|
CustomLog /dev/stdout combined
|
|
|
|
# Enable mod_rewrite for SPA routing
|
|
<Directory "/usr/local/apache2/htdocs">
|
|
Options Indexes FollowSymLinks
|
|
AllowOverride All
|
|
Require all granted
|
|
|
|
# React Router: redirect all non-file requests to index.html
|
|
RewriteEngine On
|
|
RewriteBase /
|
|
RewriteRule ^index\.html$ - [L]
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
RewriteCond %{REQUEST_URI} !^/api/
|
|
RewriteRule . /index.html [L]
|
|
</Directory>
|
|
|
|
# Proxy API requests to backend
|
|
ProxyPreserveHost On
|
|
ProxyPass /api/ http://backend:5000/api/
|
|
ProxyPassReverse /api/ http://backend:5000/api/
|
|
|
|
# Forward client IP to backend
|
|
# If X-Forwarded-For already exists (from upstream proxy), keep it
|
|
# Otherwise, set it to the client's IP
|
|
RequestHeader setifempty X-Forwarded-For "expr=%{REMOTE_ADDR}"
|
|
RequestHeader setifempty X-Real-IP "expr=%{REMOTE_ADDR}"
|
|
RequestHeader set X-Forwarded-Proto "http"
|
|
RequestHeader set X-Forwarded-Host "expr=%{HTTP_HOST}"
|
|
|
|
# Timeout for long diagram generation requests
|
|
ProxyTimeout 300
|
|
|
|
</VirtualHost>
|