Marc Betts
How Do I Test That?


How Do I Test That?


Expose port on local machine

Marc Betts's photo
Marc Betts
·Apr 14, 2021·

1 min read

Sometimes I need to access a web page or app from my computer during testing. Usually it's when I'm testing something quickly and don't want to take the time to deploy to a hosted environment or want to quickly share something with a coworker.

Luckily, there's a few ways to do this. All of this function basically the same. I keep all of them around because some of them are not always 100 percent reliable. And enterprise firewall policies are not always friendly to some of them.

Create a test page and expose it via port 8081

echo """
<head><title>test page</title></head>
<body>hey now</body>
""" > index.html

python -mSimpleHTTPServer 8081


npm install -g ngrok
ngrok http 8081
ngrok help


npm install -g localtunnel
lt --port 8081


ssh -o ServerAliveInterval=60 -R 80:localhost:8081

ssh -R 80:localhost:8081
Share this