Help with Apache rewriterule to force roundcube to use https

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with Apache rewriterule to force roundcube to use https

Robert Moskowitz
I am working on Centos7 which provides roundcubemail 1.1.7 and Apache 2.4.

My current server is Redsleeve6 (Centos6 for armv7) which I installed
roundcubemail 1.0.4.

With help here 4 years ago I developed a rewrite rule:

<VirtualHost *:80>
     ServerName webmail.test.htt-consult.com
     ServerAlias webmail

     RewriteEngine On
         RewriteCond  %{SERVER_PORT} !^443$
         RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
         ExpiresDefault "access plus 10 years"
         AddOutputFilterByType DEFLATE text/html text/plain text/xml
     php_admin_flag session.cookie_secure "1"
</VirtualHost>

This is not working 'right' in Apache 2.4.  It seems to redirecting ALL
accesses to the server to https, not just to the virtual host of
webmail.test.htt-consult.com.

So looking at Harald's post from back in 12/31/2012, I tried:

<VirtualHost *:80>
          ServerName webmail.test.htt-consult.com
          ServerAlias webmail

          RewriteEngine On
          ReWriteCond %{HTTP_HOST} =webmail.test.htt-consult.com [NC]
          RewriteCond %{SERVER_PORT} !=443
          RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
          ExpiresDefault "access plus 10 years"
          AddOutputFilterByType DEFLATE text/html text/plain text/xml
          php_admin_flag session.cookie_secure "1"
</VirtualHost>

And that is even worst.  Attempts to access
z9m9z.test.htt-consult.com/mailadmin just loop.  Take this out and I can
get to mailadmin.

So can someone help me here with current rewriterules to force roundcube
to https while not impacting on other uses of the server?

thanks
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Help with Apache rewriterule to force roundcube to use https

Maarten
I use SL(another rhel clone) and this works for me:

RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) <a href="https://%">https://%{HTTP_HOST}/$1 [NC,R,L]



On 2017-03-09 19:47, Robert Moskowitz wrote:

> I am working on Centos7 which provides roundcubemail 1.1.7 and Apache
> 2.4.
>
> My current server is Redsleeve6 (Centos6 for armv7) which I installed
> roundcubemail 1.0.4.
>
> With help here 4 years ago I developed a rewrite rule:
>
> <VirtualHost *:80>
>     ServerName webmail.test.htt-consult.com
>     ServerAlias webmail
>
>     RewriteEngine On
>         RewriteCond  %{SERVER_PORT} !^443$
>         RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
>         ExpiresDefault "access plus 10 years"
>         AddOutputFilterByType DEFLATE text/html text/plain text/xml
>     php_admin_flag session.cookie_secure "1"
> </VirtualHost>
>
> This is not working 'right' in Apache 2.4.  It seems to redirecting
> ALL accesses to the server to https, not just to the virtual host of
> webmail.test.htt-consult.com.
>
> So looking at Harald's post from back in 12/31/2012, I tried:
>
> <VirtualHost *:80>
>          ServerName webmail.test.htt-consult.com
>          ServerAlias webmail
>
>          RewriteEngine On
>          ReWriteCond %{HTTP_HOST} =webmail.test.htt-consult.com [NC]
>          RewriteCond %{SERVER_PORT} !=443
>          RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
>          ExpiresDefault "access plus 10 years"
>          AddOutputFilterByType DEFLATE text/html text/plain text/xml
>          php_admin_flag session.cookie_secure "1"
> </VirtualHost>
>
> And that is even worst.  Attempts to access
> z9m9z.test.htt-consult.com/mailadmin just loop.  Take this out and I
> can get to mailadmin.
>
> So can someone help me here with current rewriterules to force
> roundcube to https while not impacting on other uses of the server?
>
> thanks
> _______________________________________________
> Roundcube Users mailing list
> [hidden email]
> http://lists.roundcube.net/mailman/listinfo/users
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Help with Apache rewriterule to force roundcube to use https

Maarten
I meant I use Scientific Linux 7

On 2017-03-09 19:56, Maarten wrote:

> I use SL(another rhel clone) and this works for me:
>
> RewriteEngine on
> ReWriteCond %{SERVER_PORT} !^443$
> RewriteRule ^/(.*) <a href="https://%">https://%{HTTP_HOST}/$1 [NC,R,L]
>
>
>
> On 2017-03-09 19:47, Robert Moskowitz wrote:
>> I am working on Centos7 which provides roundcubemail 1.1.7 and Apache
>> 2.4.
>>
>> My current server is Redsleeve6 (Centos6 for armv7) which I installed
>> roundcubemail 1.0.4.
>>
>> With help here 4 years ago I developed a rewrite rule:
>>
>> <VirtualHost *:80>
>>     ServerName webmail.test.htt-consult.com
>>     ServerAlias webmail
>>
>>     RewriteEngine On
>>         RewriteCond  %{SERVER_PORT} !^443$
>>         RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
>>         ExpiresDefault "access plus 10 years"
>>         AddOutputFilterByType DEFLATE text/html text/plain text/xml
>>     php_admin_flag session.cookie_secure "1"
>> </VirtualHost>
>>
>> This is not working 'right' in Apache 2.4.  It seems to redirecting
>> ALL accesses to the server to https, not just to the virtual host of
>> webmail.test.htt-consult.com.
>>
>> So looking at Harald's post from back in 12/31/2012, I tried:
>>
>> <VirtualHost *:80>
>>          ServerName webmail.test.htt-consult.com
>>          ServerAlias webmail
>>
>>          RewriteEngine On
>>          ReWriteCond %{HTTP_HOST} =webmail.test.htt-consult.com [NC]
>>          RewriteCond %{SERVER_PORT} !=443
>>          RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
>>          ExpiresDefault "access plus 10 years"
>>          AddOutputFilterByType DEFLATE text/html text/plain text/xml
>>          php_admin_flag session.cookie_secure "1"
>> </VirtualHost>
>>
>> And that is even worst.  Attempts to access
>> z9m9z.test.htt-consult.com/mailadmin just loop.  Take this out and I
>> can get to mailadmin.
>>
>> So can someone help me here with current rewriterules to force
>> roundcube to https while not impacting on other uses of the server?
>>
>> thanks
>> _______________________________________________
>> Roundcube Users mailing list
>> [hidden email]
>> http://lists.roundcube.net/mailman/listinfo/users
> _______________________________________________
> Roundcube Users mailing list
> [hidden email]
> http://lists.roundcube.net/mailman/listinfo/users
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Help with Apache rewriterule to force roundcube to use https

Robert Moskowitz
In reply to this post by Maarten
Thanks,

On 03/09/2017 01:56 PM, Maarten wrote:
> I use SL(another rhel clone) and this works for me:
>
> RewriteEngine on
> ReWriteCond %{SERVER_PORT} !^443$
> RewriteRule ^/(.*) <a href="https://%">https://%{HTTP_HOST}/$1 [NC,R,L]
>

but this, I believe, rewrites for ALL accesses to the server.

For perverse reason, I only want to rewrite for webmail.  I use a cname
in DNS of

webmail.test.htt-consult.com IN CNAME z9m9z.test.htt-consult.com

and I want to leave accesses to z9m9z.test.htt-consult.com alone. Most
are restricted to internal addresses anyway.

>
>
> On 2017-03-09 19:47, Robert Moskowitz wrote:
>> I am working on Centos7 which provides roundcubemail 1.1.7 and Apache
>> 2.4.
>>
>> My current server is Redsleeve6 (Centos6 for armv7) which I installed
>> roundcubemail 1.0.4.
>>
>> With help here 4 years ago I developed a rewrite rule:
>>
>> <VirtualHost *:80>
>>     ServerName webmail.test.htt-consult.com
>>     ServerAlias webmail
>>
>>     RewriteEngine On
>>         RewriteCond  %{SERVER_PORT} !^443$
>>         RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
>>         ExpiresDefault "access plus 10 years"
>>         AddOutputFilterByType DEFLATE text/html text/plain text/xml
>>     php_admin_flag session.cookie_secure "1"
>> </VirtualHost>
>>
>> This is not working 'right' in Apache 2.4.  It seems to redirecting
>> ALL accesses to the server to https, not just to the virtual host of
>> webmail.test.htt-consult.com.
>>
>> So looking at Harald's post from back in 12/31/2012, I tried:
>>
>> <VirtualHost *:80>
>>          ServerName webmail.test.htt-consult.com
>>          ServerAlias webmail
>>
>>          RewriteEngine On
>>          ReWriteCond %{HTTP_HOST} =webmail.test.htt-consult.com [NC]
>>          RewriteCond %{SERVER_PORT} !=443
>>          RewriteRule ^.*$ <a href="https://%">https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
>>          ExpiresDefault "access plus 10 years"
>>          AddOutputFilterByType DEFLATE text/html text/plain text/xml
>>          php_admin_flag session.cookie_secure "1"
>> </VirtualHost>
>>
>> And that is even worst.  Attempts to access
>> z9m9z.test.htt-consult.com/mailadmin just loop.  Take this out and I
>> can get to mailadmin.
>>
>> So can someone help me here with current rewriterules to force
>> roundcube to https while not impacting on other uses of the server?
>>
>> thanks
>> _______________________________________________
>> Roundcube Users mailing list
>> [hidden email]
>> http://lists.roundcube.net/mailman/listinfo/users
>
_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Help with Apache rewriterule to force roundcube to use https

Andreas Meyer
Robert Moskowitz <[hidden email]> schrieb am 09.03.17 um 14:12:53 Uhr:
 
> webmail.test.htt-consult.com IN CNAME z9m9z.test.htt-consult.com

how about this one?

RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} ^/.*
RewriteRule ^(.*)$ https://webmail.test.htt-consult.com$1 [R,L]

_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users

attachment0 (220 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help with Apache rewriterule to force roundcube to use https

Robert Moskowitz


On 03/09/2017 03:22 PM, Andreas Meyer wrote:
> Robert Moskowitz <[hidden email]> schrieb am 09.03.17 um 14:12:53 Uhr:
>  
>> webmail.test.htt-consult.com IN CNAME z9m9z.test.htt-consult.com
> how about this one?
>
> RewriteCond %{SERVER_PORT} 80
> RewriteCond %{REQUEST_URI} ^/.*
> RewriteRule ^(.*)$ https://webmail.test.htt-consult.com$1 [R,L]

This took a request to:

http://z9m9z.test.htt-consult.com/mailadmin/setup.php

and mapped it to

https://webmail.test.htt-consult.com/mailadmin/setup.php

So no, not what I wanted.

thanks for the suggestion.

_______________________________________________
Roundcube Users mailing list
[hidden email]
http://lists.roundcube.net/mailman/listinfo/users