forcing http to go to https

Patrick Boutilier boutilpj at ednet.ns.ca
Fri Jun 25 01:54:35 UTC 2004



Steven Stern wrote:
> On Thu, 24 Jun 2004 17:49:51 +0200, Alexander Dalloz
> <alexander.dalloz at uni-bielefeld.de> wrote:
> 
> 
>>Put these lines in the /etc/httpd/conf/httpd.conf anywhere near the end.
>>Don't put it inside the SSL vhost config!
> 
> 
> Bear with me a little more.  I'm still not seeing how the loop is created. 

 From what I can see you are redirecting port 443 traffic to port 443 
again creating a loop.

<VirtualHost *:443>
    ServerAdmin  webmaster at foo.com
    DocumentRoot /var/www/html/horde/
    Alias /horde/ /var/www/html/horde/
    ServerName webmail.foo.com
  </VirtualHost>

#<Directory /var/www/html/horde/>
#    RewriteEngine      on
#    RewriteCond        %{SERVER_PORT} !=443
#    RewriteRule         ^.* - [F]
#    ErrorDocument    403 https://webmail.foo.com/
#</Directory>





Try something like this:



<VirtualHost *:443>
    ServerAdmin  webmaster at foo.com
    DocumentRoot /var/www/html/horde/
    Alias /horde/ /var/www/html/horde/
    ServerName webmail.foo.com
  </VirtualHost>


<VirtualHost *:80>
    ServerAdmin  webmaster at foo.com
    DocumentRoot /var/www/html/horde/
    Alias /horde/ /var/www/html/horde/
    ServerName webmail.foo.com
    Redirect / https://webmail.foo.com
  </VirtualHost>

#<Directory /var/www/html/horde/>
#    RewriteEngine      on
#    RewriteCond        %{SERVER_PORT} !=443
#    RewriteRule         ^.* - [F]
#    ErrorDocument    403 https://webmail.foo.com/
#</Directory>


> 
> I need to have the rewrite to avoid http://webroot.mydomain.com/horde being
> available.

<VirtualHost *:80>
    ServerAdmin  webmaster at foo.com
    DocumentRoot /var/www/html/
    ServerName webroot.mydomain.com
    Redirect /horde https://webmail.foo.com
  </VirtualHost>



> 
> The <directory> re-write is at the very end of httpd.conf, after all virtual
> servers have been defined.  I still get the too many redirects error.
> 
> Here's an abstracted version of httpd.conf.  When I uncomment that last
> <directory> stanza, things go bad.
> 
> Listen 80
> DocumentRoot "/var/www/html"
> <Directory "/var/www/html">
> 
>     Options Indexes FollowSymLinks 
>     AllowOverride None
>     Order deny,allow
>  </Directory>
> NameVirtualHost *:80
> NameVirtualHost *:443
> <VirtualHost *:80>
>    ServerAdmin root at localhost.localdomain
>    DocumentRoot /var/www/html
>    ServerName ciscy
> </VirtualHost>
> <VirtualHost *:80>
>    ServerAdmin  webmaster at foo.com
>    DocumentRoot /var/www/html/sds
>    ServerName steve.foo.com
> </VirtualHost>
> <VirtualHost *:80>
>    ServerAdmin webmaster at foo.com
>    DocumentRoot /var/www/html/marilyn
>    ServerName marilyn.foo.com 
>   </VirtualHost>
> <VirtualHost *:80>
>    ServerAdmin webmaster at foo.cdom
>    DocumentRoot /var/www/html/gallery
>    ServerName gallery.foo.com
> </VirtualHost>
> 
> <Directory /var/www/html/learnphp>
> # secure test scripts that may not themselves be secure or in development
>   Options +Indexes
>   AuthType Basic
>   AuthName "PHP Development"
>   AuthUserFile /etc/http-auth-users
>   Require user sdstern
> </Directory>
> 
> <VirtualHost *:443>
>    ServerAdmin  webmaster at foo.com
>    DocumentRoot /var/www/html/horde/
>    Alias /horde/ /var/www/html/horde/
>    ServerName webmail.foo.com
>  </VirtualHost>
> 
> #<Directory /var/www/html/horde/>
> #    RewriteEngine      on
> #    RewriteCond        %{SERVER_PORT} !=443
> #    RewriteRule         ^.* - [F]
> #    ErrorDocument    403 https://webmail.foo.com/
> #</Directory>
> 
> 
> 
> 
> --
>    Steve
>    
> 
> 





More information about the fedora-list mailing list