Skip to content

Commit 3df101b

Browse files
committed
fixed to correctly pass WebSocket headers
1 parent 1728e26 commit 3df101b

File tree

1 file changed

+27
-14
lines changed

1 file changed

+27
-14
lines changed

examples/web-server/apache/README.md

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@
1414
sudo apt install apache2
1515
```
1616

17-
4. Stop Apache service and disable default site:
17+
4. Enable the following Apache modules:
18+
19+
```console
20+
sudo a2enmod proxy
21+
sudo a2enmod proxy_http
22+
sudo a2enmod ssl
23+
sudo a2enmod rewrite
24+
```
25+
26+
5. Stop Apache service and disable default site:
1827

1928
```console
2029
sudo a2dissite 000-default.conf
@@ -65,19 +74,23 @@
6574

6675
```apache
6776
<VirtualHost *:443>
68-
ServerName YOUR_SUBDOMAIN
69-
ServerAlias *.YOUR_SUBDOMAIN
70-
ErrorLog ${APACHE_LOG_DIR}/error.log
71-
CustomLog ${APACHE_LOG_DIR}/access.log combined
72-
73-
ProxyPass / http://127.0.0.1:3000/
74-
ProxyPassReverse / http://127.0.0.1:3000/
75-
ProxyRequests Off
76-
ProxyPreserveHost On
77-
78-
# SSL configuration
79-
SSLCertificateFile /etc/letsencrypt/live/YOUR_SUBDOMAIN/fullchain.pem
80-
SSLCertificateKeyFile /etc/letsencrypt/live/YOUR_SUBDOMAIN/privkey.pem
77+
ServerName dev.dietstyler.com
78+
ServerAlias *.dev.dietstyler.com
79+
ErrorLog ${APACHE_LOG_DIR}/error.log
80+
CustomLog ${APACHE_LOG_DIR}/access.log combined
81+
82+
ProxyPass / http://127.0.0.1:3000/
83+
ProxyPassReverse / http://127.0.0.1:3000/
84+
ProxyRequests Off
85+
ProxyPreserveHost On
86+
87+
RewriteEngine On
88+
RewriteCond %{HTTP:Connection} Upgrade [NC]
89+
RewriteCond %{HTTP:Upgrade} websocket [NC]
90+
RewriteRule /(.*) ws://127.0.0.1:3000/$1 [P,L]
91+
92+
SSLCertificateFile /etc/letsencrypt/live/dev.dietstyler.com/fullchain.pem
93+
SSLCertificateKeyFile /etc/letsencrypt/live/dev.dietstyler.com/privkey.pem
8194
</VirtualHost>
8295
```
8396

0 commit comments

Comments
 (0)