Skip to content

Instantly share code, notes, and snippets.

Last active Jan 29, 2018
What would you like to do?
Customfile for VVV to run on host machine IP address
# you can put this file in place by
# navigating to your VVV directory (e.g. `cd ~/vagrant-local`)
# and running
# curl -O
# set port forwarding from host 8080 to guest 80
# set port forwarding from host 8443 to guest 443 "forwarded_port", guest: 80, host: 8080 "forwarded_port", guest: 443, host: 8443
if defined? VagrantPlugins::Triggers
# port forwarding setup and removal for running on your host primary IP address
config.trigger.after [:up, :reload, :provision], :stdout => true do
system('echo "
rdr pass inet proto tcp from any to any port 80 -> port 8080
rdr pass inet proto tcp from any to any port 443 -> port 8443
" | sudo pfctl -ef - >/dev/null 2>&1; echo "Add Port Forwarding (80 => 8080)\nAdd Port Forwarding (443 => 8443)"')
config.trigger.after [:halt, :suspend, :destroy], :stdout => true do
system('sudo pfctl -F all -f /etc/pf.conf >/dev/null 2>&1; echo "Removing Port Forwarding (80 => 8080)\nRemove Port Forwarding (443 => 8443)"')
Copy link

salcode commented Mar 19, 2015

Props to @speakus for condensing three lines into one. Revision made 2015-03-19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment