FedoraForum.org - Fedora Support Forums and Community
Results 1 to 1 of 1
  1. #1
    Join Date
    May 2006
    Location
    Southern California
    Age
    28
    Posts
    291

    Apache won't redirect http to SSL. Recieve 400 error

    OK I set up my website to run off of port 80. Recently I decided to incorporate SSL into my entire website, inclugind the main page. So I have it all set up but when ever I visit my main page (i.e. http://www.domain.com/) I recieve a error 400 bad request. I tried to append this to the end of my httpd.conf ( I have edited out my server's name for obvious reasons)
    ;

    Code:
    <VirtualHost *:80>
    RewriteEngine on
    #RewriteCond   %{SERVER_PORT}  !^443$
    #RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [R,L]
    RewriteCond %{SERVER_PORT} !^443$
    RewriteRule ^/(.*):80$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
    
    ServerAdmin kyle@subdomain.dyndns.com
    DocumentRoot /var/www/html/
    ServerName subdomain.dyndns.com
    SSLEngine on
    SSLCertificateFile /var/www/ssl/cert.pem
    SSLCertificateKeyFile /var/www/ssl/key.pem
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    </VirtualHost>
    I haven't really edit my ssl.conf in /etc/httpd/conf.d
    Now I know that SSL is working because all I have to do is add an s to the http is the address bar and my site suddenly pops up with my self-signed certificate.

    I have tried almost everything to redirect. It's just the main page. I would like to deny ALL non-SSL requests and redirect them to port 443.

    EDIT 1:

    OK So I have made is so that it requires SSL for ALL subdirectories for my site with SSLRequireSSL. But for some reason the virtual hosts are either being ignored or the mod_rewrite module is being ignored. Because all redirection using mod_rewrite is nonexistant.

    EDIT 2:

    Problem Solved!!!
    As it turns out, In the code above, I call for the module mod_ssl. Now I also have an option in my config file to call all files with the extension .conf in the directory /etc/httpd/conf.d And as it turns out one of those files was ssl.conf. I already knew of it's existance but in this conf file is also called to load the mod_ssl module. I simple commented out the following lines form my httpd.conf

    Code:
    SSLEngine on
    SSLCertificateFile /var/www/ssl/cert.pem
    SSLCertificateKeyFile /var/www/ssl/key.pem
    SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
    Those evil lines caused me lots of trouble!
    Last edited by KClaisse; 17th August 2006 at 02:36 AM.

Similar Threads

  1. Apache HTTP web server 2.2.8 compile error
    By gully300 in forum Servers & Networking
    Replies: 1
    Last Post: 1st June 2008, 07:07 AM
  2. Replies: 0
    Last Post: 7th May 2008, 01:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •