SSL - how to make both http and https work

47,590

Solution 1

Seems that your Apache httpd is misconfigured and tries to serve HTTPS on the HTTP port (take a look at your virtual host configuration for the Drupal site) or you are using a scheme like http://example.com:443/ to access your Drupal installation, which will not work either.

Solution 2

HTTP should be served on port 80 HTTPS should be served on port 443

Your site should work on: http://www.domain.com https://www.domain.com.

It could be one of a few things:

  • You are manual specifying the port, EG if you visit http://www.domain.com:443/, this would normally fail
  • The web server is configured incorrectly and is for some reason service SSL content on port 80. This would not normally happen unless there is a bug or something in your control panel. Have you restarted apache?
  • In the drupal configuration, it is set up that the website URL is "http://www.domain.com:443". This would always forward you to this location even if you type http://www.domain.com in your browser.
  • You have Drupal Secure Pages installed but is configured incorrectly. If you have it installed, visit https://www.domain.com/admin/build/securepages to configure it.

I think that summarizes what the issue could be, let us know your solution!

Share:
47,590

Related videos on Youtube

jsims281
Author by

jsims281

E-Commerce Web developer at Regatta working with Magento 2

Updated on September 17, 2022

Comments

  • jsims281
    jsims281 over 1 year

    I have set up a Drupal 6 site on a dedicated server, and enabled SSL through the "Matrix" control panel which was installed on it.

    The problem is now, the site ONLY loads pages from https. Most of the images wont load either, I presume this is related to the same thing. Ideally I want both http and https to work, then I can sort out the redirects for pages that need to be secure.

    The error presented on attempting to load a regular http page is:

    **Bad Request**
    
    Your browser sent a request that this server could not understand.
    Reason: You're speaking plain HTTP to an SSL-enabled server port.
    Instead use the HTTPS scheme to access this URL, please.
    

    Can anyone point me in the right direction?


    Edit:

    In sites-enabled/domainname.co.uk there is a <VirtualHost> set up for the IP of the server, using port 80 like so:

    <VirtualHost xx.xx.xx.xx:80>
            ServerName xx.co.uk
            ServerAlias www.xx.co.uk
            ServerAdmin [email protected]
            DocumentRoot /home/default/xx.co.uk/user/htdocs
            ErrorLog /home/default/xx.co.uk/user/logfiles/error_log
            TransferLog /home/default/xx.co.uk/user/logfiles/access_log
            php_admin_value open_basedir /tmp:/home/default/xx.co.uk
            SuexecUserGroup xx matrixdomain
            ScriptAlias /cgi-bin/ /home/default/xx.co.uk/user/htdocs/cgi-bin/
            AddHandler server-parsed .shtml
            AddType text/html .shtml
            <Location />
                    Options +Includes
            </Location>
    # Begin user directives <--
    # --> End user directives
    

    Would I need to make another one for 443?

    In ports.conf I have

    NameVirtualHost *:80
    Listen 80
    
    <IfModule mod_ssl.c>
        # SSL name based virtual hosts are not yet supported, therefore no
        # NameVirtualHost statement here
        Listen 443
    </IfModule>
    
  • jsims281
    jsims281 over 14 years
    In sites-enabled/domainname.co.uk I have a <VirtualHost> set up for the IP of the server, using port 80 (e.g. 12.34.56.78:80). Would I need to make another one for 443?
  • jsims281
    jsims281 over 14 years
    Am using that, but it's one step ahead of where I am now - I need to get the server to work on 80 before I can start picking pages to redirect...
  • joschi
    joschi over 14 years
    Yes. And additionally the new VirtualHost has to contain some directives (see httpd.apache.org/docs/2.2/ssl/ssl_howto.html) to enable SSL for it.
  • jsims281
    jsims281 over 14 years
    The matrix control panel was doing a horrible job, wiping it out and doing the set up manually fixed the issue.