# ============================================================================= # 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 # ============================================================================= ServerAdmin webmaster@localhost DocumentRoot /usr/local/apache2/htdocs # Logs ErrorLog /dev/stderr CustomLog /dev/stdout combined # Enable mod_rewrite for SPA routing 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] # 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