Last Updated: February 25, 2016
·
1.695K
· bendihossan

Grunt server + Vagrant: Port forwarding & IPs

In your Vagrantfile...

Forward a port from your host machine to 8000 on the guest. 8000 is the default port the grunt server runs on.

config.vm.network "forwarded_port", guest: 8000, host: 8094

Forward port 35729 on your host to the guest. 35729 is the port used by livereload: https://github.com/gruntjs/grunt-contrib-watch#optionslivereload

config.vm.network "forwarded_port", guest: 35729, host: 35729

In your Gruntfile.js use the 0.0.0.0 IP address to allow access from the parent machine & local machine:

connect: {
    options: {
        hostname: '0.0.0.0'
    },
},

https://github.com/gruntjs/grunt-contrib-connect/issues/60

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

The website is part of the attack surface, not only the API behind it. Every script, iframe, and tag on a public page is code that did not go through the same review as the backend.

Security insights from Cside