RE: Switching between http and https

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Brian,
 
you right, I did correction, but it seems not working for ssl and it works for nossl
 
this is my rewrite rules
 
RewriteEngine On
RewriteLog logs/webserver1/rewrite_log
#
RewriteCond %{HTTP_HOST} ^webserver1.*
RewriteCond %{HTTPS} =off
RewriteCond %{SERVER_PORT} ^80
RewriteRule ^/nossl(.*)    /tomcat/nossl$1 [P,QSA,L]
RewriteRule ^/ssl(.*)$     https://%{SERVER_NAME}:443/ssl$1 [NC,L]
#
#
RewriteCond %{HTTP_HOST} ^webserver1.*
RewriteCond %{HTTPS} =on
RewriteCond %{SERVER_PORT} ^443
RewriteRule ^/ssl(.*)      /tomcat/ssl$1 [P,QSA,L]
RewriteRule ^/nossl(.*)$   http://%{SERVER_NAME}:80/nossl$1 [NC,L]
#

this is my proxy balancer:
 
<Proxy balancer://tomcat/>
        BalancerMember ajp://appserver:8009 route=r1 loadfactor=1 keepalive=On
</Proxy>
<Location /tomcat/nossl/>
        ProxyPass        balancer://tomcat/sossl/    nofailover=On lbmethod=byrequests
        ProxyPassReverse balancer://tomcat/nossl/
        Order Deny,Allow
        Allow from all
</Location>
<Location /tomcat/ssl/>
        ProxyPass        balancer://tomcat/ssl/    nofailover=On lbmethod=byrequests
        ProxyPassReverse balancer://tomcat/ssl/
        Order Deny,Allow
        Allow from all
</Location>

 
Any suggestion?
 
thanks.
 
Inas.

 
> Date: Wed, 1 Apr 2009 12:07:11 -0400
> From: mearns.b@xxxxxxxxx
> To: users@xxxxxxxxxxxxxxxx
> Subject: Re: Switching between http and https
>
> On Wed, Apr 1, 2009 at 11:19 AM, inas inassen <mezghena@xxxxxxxxxxx> wrote:
> >
> > Hi all,
> >
> > I'm using mod_proxy balancer with tomcat and apache.
> > I used mod_rewrite to switch between http and https
> >
> > When I have the pattern /nossl ==> I want to redirect to http
> > When I have the pattern /ssl   ==> I want to redirect to https
> >
> > so I write the following rules:
> >
> > RewriteEngine On
>
> The answer lies within...
> > RewriteLog logs/webserver1/rewrite_log
>
>
> > #
> > RewriteCond %{HTTP_HOST} ^webserver1.*
> > RewriteCond %{HTTP} =on
> > RewriteCond %{SERVER_PORT} ^80
> > RewriteRule ^/nossl(.*)    /balancer/nossl$1 [P,QSA,L]
> > RewriteRule ^/ssl(.*)$     https://%{SERVER_NAME}:443/ssl$1 [NC,L]
> > #
> > #
> > RewriteCond %{HTTP_HOST} ^webserver1.*
> > RewriteCond %{HTTPS} =on
> > RewriteCond %{SERVER_PORT} ^443
> > RewriteRule ^/ssl(.*)      /balancer/ssl$1 [P,QSA,L]
> > RewriteRule ^/nossl(.*)$   http://%{SERVER_NAME}:80/nossl$1 [NC,L]
> > #
> > Is there something wrong, because it doesn't work
> Then yes, there's something wrong =J.
>
> As far as I know, and can see in the documentation, this var is not correct:
> RewriteCond %{HTTP} =on
> If you want to match when HTTPS is not active, you want:
> RewriteCond %{HTTPS} =off
> [http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond]
>
> Beyond that, you'll have to be more explicit about how it's not
> working. What page do you access, and how does it respond? what does
> the rewrite log say?
>
> -Brian
>
> --
> Feel free to contact me using PGP Encryption:
> Key Id: 0x3AA70848
> Available from: http://pgp.mit.edu/
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>


Vous voulez savoir ce que vous pouvez faire avec le nouveau Windows Live ? Lancez-vous !

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux