By Robbie | July 11, 2020
This tutorial will show you how to use expose.sh to give you a public HTTPs URL that you can use to test your site or app with multiple browsers and operating systems.
For Mac or Linux, go to Expose.sh and copy/paste the installation code shown into a terminal.
For Windows go to Expose.sh, download the binary and put it somewhere in your PATH.
Expose your local site to the web
Find out what port your local site is using. Once you know what that is, run
expose <port>. For example, if your site runs on port 80 run
Expose.sh will generate a random public expose.sh URL. You’ll see output like:
https://s3rh.expose.sh is forwarding to localhost:80 http://s3rh.expose.sh is forwarding to localhost:80
You can use the HTTPs or HTTP urls for testing, but we recommend HTTPs for security.
Speaking of HTTPs, expose.sh is also an easy way to test your site locally using HTTPs, which would otherwise be complex to manually set up.
Test on different browsers and operating systems
On the same or a different machine or VM, open the browser you want to test on and enter in the URL from the expose.sh output.
For cross operating system testing you could use a separate machine or a vm, both will be able to use your expose.sh URL.
For example, you could be running Linux or Windows and then go to the URL in Safari on a Mac.
You could also have another person in a different location do the testing, or even a whole QA team.
Using a custom subdomain (like mysite.expose.sh) would save you from needing to enter in different URL each time.
Expose.sh is free to use for randomly generated subdomains. If you want to use your own custom subdomains like “mysite.expose.sh”, you can do this for as little as $5/month depending on how many domains you want to use. Its usually a good time vs money investment, considering the hourly rate of most people who use expose.sh for work. Sign up here.
Once you’ve signed up, you can use a custom subdomain by running
expose <port> as mysite.expose.sh replacing port with your port and mysite with the subdomain you want to use.
Using expose.sh, you can easily run one local instance of your site or app and then use the same public URL to test locally and on different machines/vms running the same or different operating systems.
You could also combine it with tools like BrowserStack and test lots of different browsers/operating systems using the same URL. Often these services have their own solutions for local access, but they are generally more complicated to set up than expose.sh. Its usually easiest to generate a public url with expose.sh and use that directly.
Happy coding!Get started here