Author Topic: how to force https on rouncube webmail  (Read 8805 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
how to force https on rouncube webmail
« on: March 20, 2020, 01:04:16 AM »
Hello guys, I installed CWP and loving it, but got some issues with forcing https on my site so my questions are simple:
1-how to force https on all my domains without using the .htaccess file, is there any better way?
2-do i have to request a new letsencrypt SSL for each domain and subdomain i created?  cant it be shared?
3-how to properly force https on roundcube webmail? lets encrypted is installed however if i typed http://webmail.domainname.com it doesnt redirect to https, so need this to be working.
thats all for now. thanks in advanced.
cheers

Offline
*
Re: how to force https on rouncube webmail
« Reply #1 on: March 20, 2020, 02:28:47 AM »
U need to edit the apache template and regenerate the vhosts for Server wide ssl for your Domains.

Cant give you an example howto do but maybe another Person :)

Offline
*
Re: how to force https on rouncube webmail
« Reply #2 on: July 06, 2020, 12:00:19 AM »
Im having trouble getting my webmail to force https as well. My webmail domain sits at mydomain.com/webmail. I have tried editing the .htaccess (works for the main domain but not the /webmail). Also edited the webmail.conf located at /usr/local/cwpsrv/conf.d/webmail.conf with the following code :

Code: [Select]
return 301 https://$host:2096$request_uri;
Nothing seems to be working. Anyone figure this out yet?

Offline
*****
Re: how to force https on rouncube webmail
« Reply #3 on: July 06, 2020, 11:08:58 AM »
Hi,

The most practical way to force webmail to secure mode for all user accounts is to apply the nginx force-https template in WebServers Settings -> WebServers Master Conf or only for specific users in WebServers Domain Conf.

Offline
*
Re: how to force https on rouncube webmail
« Reply #4 on: February 11, 2021, 06:43:54 AM »
I had this HTTP to HTTPS working some days ago, But after the CWP update, I guess the configuration changes I made were reset.

I tried again to set a redirect in webmail.conf but now I get too many redirects error and certificate error. I tried changing in Apache directly and it worked. I know this is not te best solution but it can be labelled as a workaround.

Webserver Setting >  Webserver Conf Editor > Apache Tab > Vhost file tab > Select Configuration file for Domain you wish to change redirection.

Before:
Code: [Select]
<VirtualHost 103.205.140.126:80>
   ServerName webmail.domain.com

   <IfModule mod_proxy.c>
      ProxyRequests Off
      ProxyPreserveHost On
                .
                .
                .

After:
Code: [Select]
      .
      .
      .
<VirtualHost 103.205.140.126:80>
   ServerName webmail.domain.com
       
       RewriteEngine On
       RewriteCond %{HTTPS} off
       RewriteRule (.*) https://%{SERVER_NAME}$1 [R,L]

   <IfModule mod_proxy.c>
      ProxyRequests Off
      ProxyPreserveHost On
      .
      .
      .
[code]
Do the same for mail.domain.com
If you have many domains I think there must be some way to have a common vhost configuration somewhere but not sure. Maybe you need to edit the template and rebuild apache to make this rule server-wide in one shot.