I have setup the Rocket.Chat server on AWS EC2 instance. Also, I have created the Apache configuration so that it should be accessible from web as well. But for security I have to attach SSL. So, I have attached it to. But problem is, for example, if I access my website without https that is with http://chat.example.com it don't redirects me to https. But when I access the website with https://chat.example.com it shows me the ssl I have applied for. I have two files one is for port 80 and one is for port 443 but both of them not connected. Please help me to redirect my port 80 websocket to port 443.
Following is my configuration for port 80: Port 80 Configuration for Rocket.Chat webApp
This Configuration opens same website without ssl.
<VirtualHost *:80>
ServerName chat.example.in
LogLevel info
ErrorLog /var/log/chat.example.in_error.log
TransferLog /var/log/chat.example.in_access.log
<Location />
Require all granted
</Location>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:3000/$1 [P,L]
ProxyPassReverse / http://localhost:3000/
Below is the configuration for port 443 which opens for same website with ssl. Port 443 Configuration for Rocket.Chat webApp
<VirtualHost *:443>
ServerName chat.example.in
ProxyPass / http://localhost:3000/
LogLevel info
ErrorLog /var/log/chat.example.in_error.log
TransferLog /var/log/chat.example.in_access.log
SSLEngine On
SSLCertificateFile /etc/letsencrypt/live/chat.example.in/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/chat.example.in/privkey.pem
<Location />
Require all granted
</Location>
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:3000/$1 [P,L]
ProxyPassReverse / http://localhost:3000/
Can anyone tell me what should I add to my port 80 Configuration to redirect to 443 port?
Aucun commentaire:
Enregistrer un commentaire