Setup Local Sitecore Instance to Public using ngrok
Mohamed Sirajudeen
Senior Sitecore Consultant at INSCALE |??2x Sitecore Technology MVP |??4x Sitecore? Certified |??AI Enthusiast |???Blogger |???Speaker
In this article, we are going to see how to setup the local sitecore URL to be available for public using ngrok. This public ngrok URL will be used in application to access the Sitecore URL after Vercel deployment in future.
Ngrok allows us to expose a web server running on our local machine to the internet. Just we need to tell what port our web server is listening on. If we don’t know what port our web server is listening, its probably 80, the default for HTTP. If its HTTPS means, the port is 443.
How to get started ?
Step 1 – Sign up for a free account at https://ngrok.com/
Step 2 – Download and run ngrok.exe (use windows 64 bit download).
Step 3 – you will get the auth token after done the successful registration with ngrok. So, use the auth token, we need to connect the local ngrok to our account.
Step 4 – we need to run below command.
ngrok.exe authtoken <our token should be here>
The token is saved in ~/.ngrok2/ngrok.yml on our system, for later usages.
Step 5 – Expose our local Sitecore Instance with below command.
ngrok.exe http –host-header=rewrite <sitecore-domain>:443
Step 6 – once we run the above command, we can see the below screen contains the information of Web Interface and public URL.
领英推荐
Step 7 – we can check the status by clicking the following URL è https://127.0.0.1:4040/status
Step 8 – we can redirect to the public URL to check whether the sitecore is up and running.
Go to https://5562-223-233-82-185.ngrok-free.app/sitecore/ (Public URL).
Step 9 – To proceed further with this public URL, we need to do the configuration in local NextJs application level.
Update the <app-name>.config in the NextJs application with new hostname.
Step 10 – Update Sitecore API Host in .env file
Step 11 – Update the deployUrl and layoutServiceHost in scjssconfig.json file.
Now the public URL for sitecore instance and all the configurations are ready to deploy the application in Vercel. We will see how to deploy the local NextJs application in Vercel in future.
That’s the end of this article.
Happy Sitecoring !!!