By Robbie | July 11, 2020
This tutorial will show you how to use expose.sh to instantly give you a public HTTPs URL that you can use to test your site, api or app running locally. No server config or hacks are required.
This is much easier and more secure than many other methods such as self signed certificates which are often difficult to integrate with modern browsers that no longer provide an easy way to trust “invalid” certificates.
Instead of hacking your browser or OS to trust your certificate, you can just use expose.sh to instantly generate a public HTTPs url which will point to your local development instance.
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.
Get a public HTTPs URL for your server
Find out what port your local server is using. Once you know what that is, run
expose <port>. For example, if your server runs on port 80 run
Expose.sh will generate random public expose.sh URLs. You’ll see output like:
https://s3rh.expose.sh is forwarding to localhost:80 http://s3rh.expose.sh is forwarding to localhost:80
Both HTTP and HTTPs URLs will be generated. For the purposes of this tutorial use the HTTPs URL.
Open the HTTPs URL
In your browser, enter in the HTTPs URL.
Your site running locally will load in the browser over HTTPs. If not, double check that your local server has started.
Now you can test your site and make sure everything works as it should. You can also test HTTPs only features like push notifications.
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 create a HTTPs URL for your locally running site, api or app.
Its alot easier and safer than other common methods like hacking your browser or operating systems certificate store to trust your generated or self signed SSL cert.
Happy coding!Get started here