webapps with SSL

Assume you have custombuild 2, You need to edit custombuild/options.conf and set

Code:
redirect_host=your.server.name
redirect_host_https=yes
 
I should write that I tried that already too. It didn't resolve the issue.
 
Do you have a SSL certificate for your servername?
Can you access your Directadmin login anyway through https?
 
Yes I do. I installed wildcard SSL. And yes, DA is working fine with https.
 
Okay, let´s start at the beginning: First
Code:
cd /usr/local/directadmin/custombuild
./build update
./build set use_hostname_for_alias yes
./build set redirect_host_https yes
./build rewrite_confs

to be sure you build everything right.

If you access it directly through https://your.server.name/roundcube, do you see a secured connection?

because maybe you mean that you want to FORCE http to https if anypone try to access through unsecured http, then add (Credit goes to zEitEr) near the bottom of the /etc/httpd/conf/extra/httpd-includes.conf the following:

Code:
################################################################################
#                          HTTP to HTTPS Rewrite
################################################################################
<location /phpMyAdmin>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /webmail>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /squirrelmail>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /roundcube>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /atmail>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>

then restart httpd (Apache)
 
Last edited:
Thanks for suggestion. If using httpd-includes.conf, yes, now it's working. Without it, redirect is not working. A bug in CB for redirect_host_https?
 
Okay, let´s start at the beginning: First
Code:
cd /usr/local/directadmin/custombuild
./build update
./build set use_hostname_for_alias yes
./build set redirect_host_https yes
./build rewrite_confs

to be sure you build everything right.

If you access it directly through https://your.server.name/roundcube, do you see a secured connection?

because maybe you mean that you want to FORCE http to https if anypone try to access through unsecured http, then add (Credit goes to zEitEr) near the bottom of the /etc/httpd/conf/extra/httpd-includes.conf the following:

Code:
################################################################################
#                          HTTP to HTTPS Rewrite
################################################################################
<location /phpMyAdmin>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /webmail>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /squirrelmail>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /roundcube>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>
<location /atmail>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>

then restart httpd (Apache)

Sorry for replying on old post, you can also transform all of the above by just writing this one directive and it will enable for all subURLs without specifying one by one:

Apache config:
<location /*>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</location>

Thanks for suggestion. If using httpd-includes.conf, yes, now it's working. Without it, redirect is not working. A bug in CB for redirect_host_https?

correct me if I'm wrong: When you enable redirect_host_https=yes, DA only enable https redirect on specific subdirectory specified in httpd-alias.conf and ignore other directories. For example, if redirect_host_https=yes, and when you run ./build rewrite_confs,
you will notice that DA will put https keyword in RewriteRule line in on of the example here in httpd-alias.conf:

Apache config:
.......
Alias /phpmyadmin /var/www/html/phpMyAdmin
RewriteCond %{HTTP_HOST} !^server.domain.com$
RewriteCond %{REQUEST_URI} ^/pma/ [OR]
RewriteCond %{REQUEST_URI} ^/pma$
RewriteRule ^/pma(.*) [B]https[/B]://server.domain.com/phpMyAdmin$1
......

and if you disable redrect_host_https=no, and when you ./build rewrite_confs, the https will become http. So, to enable all https redirect just use the first code. You can check whether this work or not by looking at that httpd-alias.conf.
 
Last edited:
Back
Top