Search code examples
hostsngrok

Is it possible to share my localhost with someone on a different network?


I am working with a designer and I'd like them to have access to the interactions I've implemented on the site we're working on. However this time, I have 2 issues. My localhost is configured to a subdomain: http://store.teststore:3000/ and we're on different networks. Is there anyway to work around this?


Solution

  • ngrok should work for you. Download and install it following these instructions here: https://ngrok.com/download. Documentation on how it is used can be found here https://ngrok.com/docs. Once installed running the below command should work for you (depending on the hosting environment):

    ngrok http -host-header=rewrite store.teststore:3000

    You will need to give the URL generated by ngrok and displayed in the cmd prompt to the designer.

    Update: Handling absolute redirects

    Based on your comment it sounds like, after login, your site does an absolute redirect (the full URL is specified). If it is possible I would change your code to do a relative redirect where the domain is omitted. You could also make your root domain configurable in the absolute redirect and configure it to be the ngrok domain provided for now. Lastly, you could attempt to configure your DNS with a CNAME record following ngroks Tunnels to custom domains documentation. This last option, however, requires a paid for ngrok subscription.