Socket.io - how to get client URL request on server side?

In my app.js (server) i need to known from where (URL) the request come from.

Actually i'm passing url parameter client.side:

socket.emit('request', window.location.href);

and processing it on server side

socket.on('request', function(url){
    console.log(url);
    ...
});

But that's clearly risky and unsecure (clients can send anything to the server).

So i'm guessing.. is it possible to get the URL parameter only on server side? Maybe from the socket object?

To obtain the connection URL

io.sockets.on('connection', function(socket) {

    console.log("url: " + socket.handshake.url);

});

This will return something like: url: /socket.io/1/?t=1407807394827