Search code examples
node.jseveryauth

Setting up a local.host alias for localhost on windows


I'm trying to setup everyauth for my node app. Although I've reached a step that I have no idea how to accomplish.

It's asking to setup local.host as an alias for localhost, but it references some linux folders, I'm using windows.

Here's the exact instructions I'm stumped on.

Important - Some OAuth Providers do not allow callbacks to localhost, so you will need to create a localhost alias called local.host. Make sure you set up your /etc/hosts so that 127.0.0.1 is also associated with 'local.host'. So inside your /etc/hosts file, one of the lines will look like: '127.0.0.1 localhost local.host'

(source here)

How do you accomplish this on windows?


Solution

  • This can be done by editing you hosts file. Open notepad++ (or notepad) as admin. Then hit open, and select C:\Windows\System32\drivers\etc\hosts. You will see:

    # Copyright (c) 1993-2006 Microsoft Corp.
    #
    # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
    #
    # ...
    #
    # Additionally, comments (such as these) may be inserted on individual
    # lines or following the machine name denoted by a '#' symbol.
    #
    # For example:
    #
    #      102.54.94.97     rhino.acme.com          # source server
    #       38.25.63.10     x.acme.com              # x client host
    
    127.0.0.1       localhost
    ::1             localhost
    

    And add this line at the end:

    127.0.0.1       local.host
    

    Save and you're done