Report this

What is the reason for this report?

Apache not redirecting from SSL

Posted on July 17, 2019

Hey all

I have a Ubuntu server on which sailjs is installed. In order for me to use this backend from another site I need to have the connection encrypted (https). I followed this tutorial.

With sailsjs I need to reroute any incomming connections to 127.0.0.1:1337 which I have done and that works. So after following the tutorial the plain http still works but pointing to the https version just returns the default apache2 screen.

I am not very knowledgeable with these things so it could probably be something stupid. In the code my actual IP has been changed to 1.2.3.4 Please find my configurations attached.

 <VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName 127.0.0.1
        DocumentRoot /var/www/projectName/
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/projectName/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
                RewriteEngine on

                # Don't rewrite files or directories
                RewriteCond %{REQUEST_FILENAME} -f [OR]
                RewriteCond %{REQUEST_FILENAME} -d
                RewriteRule ^ - [L]

                # Rewrite everything else to index.html
                # to allow html5 state links
                RewriteRule ^ index.html [L]
                AllowOverride All
        </Directory>


        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        ProxyRequests Off

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPass / http://127.0.0.1:1337
        ProxyPassReverse / http://127.0.0.1:1337

        Redirect "/" "https://1.2.3.4/"
 </VirtualHost>
 <IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin marco.pieterse@gmail.com
                ServerName 1.2.3.4

                DocumentRoot /var/www/html


                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

              
                SSLEngine on

                SSLCertificateFile      /etc/ssl/certs/apache-selfsigned.crt
                SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key


                #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt

                #SSLCACertificatePath /etc/ssl/certs/
                #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt

                
                #SSLCARevocationPath /etc/apache2/ssl.crl/
                #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl


                #SSLVerifyClient require
                #SSLVerifyDepth  10

       
                #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                             SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>


                 BrowserMatch "MSIE [2-6]" \
                                nokeepalive ssl-unclean-shutdown \
                                downgrade-1.0 force-response-1.0

         </VirtualHost>
 </IfModule>

Please let me know if any other files are required. Thanks

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.