Skip to content

Instantly share code, notes, and snippets.

@runningskull
Created July 23, 2012 19:21
Show Gist options
  • Save runningskull/3165598 to your computer and use it in GitHub Desktop.
Save runningskull/3165598 to your computer and use it in GitHub Desktop.
Redirect to a URL after a delay
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)
@runningskull
Copy link
Author

Just visit a URL like this:

http://localhost:5000/?http://google.com

which will redirect you to google.com in 3 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment