Alexander Gromnitsky's Blog

Why Commenting is Very Important For Bloggers

Latest update:

When you forget an api call & google turns up a gem.

  1. A blog post, that isn't interesting per se, but gives a context for the next item:

    "Getting a user's IP address seems pretty straightforward in Node.js, right? [...]

    var ip = req.connection.remoteAddress;
    

    But there is a problem. If you are running your app behind Nginx or any proxy, every single IP addresses will be 127.0.0.1 [...]

    Considering that fact, here is the best way to get the IP address of a user:

    var ip = req.header('x-forwarded-for') || req.connection.remoteAddress
    

    Now you can be sure the variable ip will catch the IP address of the client, not your proxy's."

  2. User comments:

    LandonPowell says:

    'The X-FORWARDED-FOR for an IP!? You’re using a header to get an IP, you moron. Those can be spoofed with browser plugins. You can literally set your X-FORWARDED-FOR to any string. I’ve got mine set to it.stings.when.ip, and used to have it set to ‘ OR ” == 1. You should change your blog’s name from hacksparrow to hackedsparrow, because you’re obviously security illiterate.'

    Ronnie Garcia says:

    'Landon, you’re a total neckbeard. People at work (if you have a job) might like you more if you present information in a more constructive way instead of calling people morons. If I was your manager, you’d be fired immediately.'


Tags: ойті
Authors: ag