To redirect a user to a different page, we usually do:
res.writeHead(302, {
Location: '/test'
});
res.end();
What if I want to redirect him on a different port? I tried to add a field 'Port' but it seems to don t work.
You need to specify the full URL:
res.writeHead(302, {
Location: 'http://anotherdomain.com:8888/some/path'
});
res.end();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With