Last active
July 20, 2017 23:09
-
-
Save BerkeleyTrue/39139dd4eeae68df1b2d to your computer and use it in GitHub Desktop.
Redirect a url to a localhost port
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # First we need to map our localhost + port combo to another ip. You'll need root priviliges for this | |
| sudo ifconfig lo0 10.0.0.1 alias && \ | |
| echo "rdr pass on lo0 inet proto tcp from any to 10.0.0.1 port 80 -> 127.0.0.1 port 3000" | sudo pfctl -ef - | |
| # Now edit /etc/hosts | |
| sudo vim /etc/hosts | |
| # and add the following to the list | |
| # NOTE: Do not edit anthing on this list you did not add | |
| 10.0.0.1 mydomain.dev | |
| 10.0.0.1 www.mydomain.dev | |
| # I choose to use a .dev TLD as these are never going to conflict seeing how google has bought these TLD's | |
| # and kept it for internal use only. You can use what ever you like | |
| # Now browser to mydomain.dev or whatever you called it in your browser and presto! | |
| It should load up whatever server you set up on port 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This saved my life(or at least made it a lot easier), thanks!