Added SSL certificate checking and automatic SSL in production mode