-
-
Save tanepiper/d24d2de688d70e649a96 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mountie = require('mountie'); | |
var seaport = require('seaport'); | |
var ports = seaport.createServer({ secret : 'beep boop' }); | |
ports.listen(7000); | |
var server = mountie(ports); | |
server.mount(function (req, bounce) { | |
console.log(bounce); | |
if (!/^www\./.test(req.headers.host)) return; | |
var res = bounce.respond(); | |
res.statusCode = 302; | |
res.setHeader('location', req.headers.host.replace(/^www\./, '')); | |
res.end(); | |
return true; | |
}); | |
server.listen(80); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment