Created
July 23, 2012 19:21
-
-
Save runningskull/3165598 to your computer and use it in GitHub Desktop.
Redirect to a URL after a delay
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 http = require('http') | |
, url = require('url') | |
,S = http.createServer(function(req, resp) { | |
var loc = {Location: url.parse(req.url).query} | |
setTimeout(function() { | |
resp.writeHead(301, loc), resp.end() | |
}, 3000) | |
}).listen(5000) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just visit a URL like this:
http://localhost:5000/?http://google.com
which will redirect you to google.com in 3 seconds.