Files
yourpart3/yourpart-https.conf
Torsten Schulz (local) 84619fb656 Update proxy settings in yourpart-https.conf for improved WebSocket and API handling
- Added ProxyPreserveHost and ProxyRequests directives for better request handling.
- Configured WebSocket upgrade headers for Socket.io and daemon connections.
- Established HTTP proxies for API and WebSocket requests to ensure fallback mechanisms are in place.
- Improved overall clarity and organization of proxy settings in the configuration file.
2026-01-12 16:55:09 +01:00

69 lines
2.2 KiB
Plaintext

<IfModule mod_ssl.c>
<VirtualHost your-part.de:443>
ServerAdmin webmaster@your-part.de
ServerName your-part.de
ServerAlias www.your-part.de
DocumentRoot /opt/yourpart/frontend/dist
DirectoryIndex index.html
# Frontend statische Dateien
<Directory "/opt/yourpart/frontend/dist">
AllowOverride None
Options -Indexes +FollowSymLinks
Require all granted
# Fallback für Vue Router
FallbackResource /index.html
</Directory>
# Proxy-Einstellungen
ProxyPreserveHost On
ProxyRequests Off
RequestHeader set X-Forwarded-Proto "https"
AllowEncodedSlashes NoDecode
# WebSocket-Upgrade-Header (muss VOR ProxyPass stehen!)
RewriteEngine on
# WebSocket-Upgrade für Socket.io
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/socket.io/(.*)$ "ws://localhost:2020/socket.io/$1" [P,L]
# WebSocket-Upgrade für Daemon-Verbindungen
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/ws/(.*)$ "ws://localhost:4551/$1" [P,L]
# API-Requests an Backend weiterleiten
ProxyPass "/api/" "http://localhost:2020/api/"
ProxyPassReverse "/api/" "http://localhost:2020/api/"
# HTTP-Proxy für Socket.io (Fallback für Polling)
ProxyPass "/socket.io/" "http://localhost:2020/socket.io/"
ProxyPassReverse "/socket.io/" "http://localhost:2020/socket.io/"
# HTTP-Proxy für Daemon (Fallback, falls WebSocket nicht funktioniert)
ProxyPass "/ws/" "http://localhost:4551/"
ProxyPassReverse "/ws/" "http://localhost:4551/"
ErrorLog /var/log/apache2/yourpart.error.log
CustomLog /var/log/apache2/yourpart.access.log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
# SSL-Konfiguration
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/www.your-part.de/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.your-part.de/privkey.pem
# www Redirect
RewriteCond %{SERVER_NAME} =your-part.de
RewriteRule ^ https://www.%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
</IfModule>