How do I get the full url , such as http://user:pass@host.com:8080/p/a/t/h?query=string#hash .
Useing request.url can get /p/a/t/h?query=string ,but I hope to get full including #hash.
What should I do?
var http = require('http');
var url = require('url');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end(request.url + '\n');
}).listen(8124);
The hash is not sent to the server. You cannot get it server-side. (At least, not without some code running client-side sending it in another request over AJAX.)