 		res.end()
 		return
 
-
-for oldListener in oldHttpServerListeners
-	httpServer.addListener 'request', oldListener
+	next()

httpServer.removeAllListeners('request')

httpServer.addListener 'request', (req, res) ->
	if RocketChat.settings.get('Force_SSL') isnt true
		return

	remoteAddress = req.connection.remoteAddress or req.socket.remoteAddress

	isSsl = req.connection.pair or (req.headers['x-forwarded-proto'] and req.headers['x-forwarded-proto'].indexOf('https') isnt -1)

	if not isLocal and not isSsl
		host = req.headers['host'] or url.parse(Meteor.absoluteUrl()).hostname

		host = host.replace(/:\d+$/, '')

