gruntjs / grunt-contrib-connect

Start a static web server.
http://gruntjs.com
MIT License
714 stars 146 forks source link

options.hostname not working? #169

Closed goodpixels closed 9 years ago

goodpixels commented 9 years ago

I'm trying to grunt-contrib-connect to create a server under a specific URL, let's say http://my.website/. According to the documentation, all I need to do is just to change the hostname option, but I keep getting an error saying: Fatal error: getaddrinfo ENOTFOUND my.website.

Here's my gruntfile.js:

connect: {

    dev: {

        options: {

            keepalive:  true,
            port:       80,
            hostname:   'my.website',
            base:       'public'

        }

    }

},

Thanks.

timkendrick commented 9 years ago

My understanding is that the hostname option is used to say "deny all connections that do not use this hostname to access the server". Importantly, it doesn't actually set up the route that redirects my.website to 127.0.0.1 – this has to be done elsewhere.

In your case, I think the simplest solution would be to add an entry in your HOSTS file that routes my.website to 127.0.0.1