Monday, June 1, 2020

How to expose localhost Sitecore instance to the Internet

How to expose localhost Sitecore instance to the Internet?
In many cases, it's required you to expose your localhost Sitecore instance to the Internet for testing, integration with APIs, or other third parties.

There are so many secure tunnels, reverse proxy providers to which we can use to expose your localhost Sitecore instance to the internet.

You can use anyone from the following tunneling provider and can expose your localhost to the internet.

  1. http://serveo.net/ - In this blog, I will be using Serveo to expose my local Sitecore instance. 
  2. https://localhost.run/ 
  3. https://ngrok.com/

Setup a local Sitecore instance with Serveo. 

  1. Check local Sitecore instance IIS binding, in my demo its "sc825.local.com"

  2. Check our host file have an entry for your local Sitecore instance (you can find your host file C:\Windows\System32\drivers\etc)


  3. Now let's bind our local Sitecore instance to Serveo.
    Open CMD Prompt in Administrator mode and run the following command 
    ssh -R 80:sc825.local.com:80 serveo.netServeo will create one dynamically generated subdomain to route traffic from internet to your local Sitecore instance(in my case its  sc825.local.com)

  4. Now traffic will start flowing to your IIS using this dynamically generated subdomain but incoming HTTP requests will be having the host as "novitas.serveo.net", so we need to update site definition in Sitecore configuration using a patch file



  5. Add site binding in IIS for the dynamically generated subdomain ( in my case its https://novitas.serveo.net)


  6. We are done! Now restart your IIS and make sure your connection with Serveo is still alive in CMD Prompt. Browser your site using dynamically generated subdomain ( in my case its https://novitas.serveo.net)