changed req.connection.encrpyted to req.secure