ngork allows a service running on a local development server to be accessible from the internet. It runs on Windows, Linux, MacOS and FreeBSD and it’s free.
A possible scenario
Here is a possible scenario: a developer is developing a Remote Event Receiver (RER) for the SharePoint Online (SPO). A Remote Event Receiver (RER) is a Windows Communication Foundation (WCF) service registered as event handler to SPO events.
SPO sends event notifications to that RER when a document is uploaded, modified, deleted, etc. While developing and debugging a project like that, the RER is running on the local machine using an address like https://localhost:44396/
. Clearly an address like that is not accessible from the internet, the outside world. And that makes debugging impossible.
Using ngrok makes a local address accessible from the internet.
Installing ngrok
- sign up to ngork
- after a successful login go to Dashboard
- download a version according to your operationg system.
- extract the content of the zip file to any folder you like
- add the full path to ngrok folder to PATH System Environment Variable
- a successful sign-up creates an AuthToken. The AuthToken ties the locally running ngrok application to your ngrok account. You may reset that AuthToken if you wish.
- get your AuthToken from ngrok’s Dashboard and write it down.
- open a terminal and connect to your account passing that AuthToken. This needs to be done once only.
ngrok authtoken YOUR_AUTH_TOKEN_HERE
- ngrok is ready for use now
Using ngrok
ngrok provides a very instructive documentation page. You may read it. In my case, having to debug a RER as described above, I had to rewrite the Host header. Here is what worked for me in a Windows 10 machine.