app.conf
<VirtualHost *:80>
ServerName barryonweb.com
# Proxy settings for Backend API
ProxyPreserveHost On
ProxyPass /api/ http://localhost:5000/
ProxyPassReverse /api/ http://localhost:5000/
# Proxy settings for WebSockets
ProxyPass /websocket ws://localhost:5000/websocket
ProxyPassReverse /websocket ws://localhost:5000/websocket
# Serve Frontend React App
DocumentRoot /var/www/appRootDir/clientDir
<Directory /var/www/appRootDir/clientDir>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
# Enable Rewrite Engine for SPA Routing
RewriteEngine On
# If a file or directory doesn't exist, serve index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ /index.html [L]
</Directory>
# Logging
ErrorLog ${APACHE_LOG_DIR}/combined-error.log
CustomLog ${APACHE_LOG_DIR}/combined-access.log combined
</VirtualHost>