Executing Tests on Local and Firewalled Websites

Want to use Ghost Inspector locally? Here are some options.

Search our documentation:

Toggle Documentation Menu

Executing Tests on Local and Firewalled Websites

Note: The method for local testing below involves a 3rd party tool that opens up a public URL to your website. Ghost Inspector is not directly associated with this tool. Before implementing this approach at your company, we recommend consulting your network administrator.

Ghost Inspector can access local and firewalled websites through the use of ngrok. ngrok is a tool that exposes a local port to the internet via a secure tunnel. That tunnel can be used to allow Ghost Inspector to access your website and test it. You will need to sign up for a free ngrok account, then download and unzip the program.

Once you have ngrok downloaded and unzipped, you will need to set your authentication token which is available in your ngrok account. (You’ll only need to do this once.)

./ngrok authtoken [TOKEN-HERE]

Now, there are two difference scenarios. Either the website is running locally on your machine (localhost), or it’s running on a private server (with it’s own URL).

If the website is running locally on your machine, you will need to know which port it’s being served on. This is typically port 80, but may be something different (for instance, if your website is visible at http://localhost:3000, then the port is 3000). To open the tunnel, execute this command (with the port number swapped in):

./ngrok http 80

If the website is running on a private server then you are likely using a URL like http://private.mycompany.com to access it. In this case, you’ll create a tunnel to that URL using this command (with the private server URL swapped in):

./ngrok http -host-header=rewrite private.mycompany.com:80

Once ngrok opens the tunnel, it’ll provide a public ngrok.io URL (ex: https://0b99c72f.ngrok.io) which can be used for your test(s) start URL. If you open this ngrok.io URL in your browser, you’ll see the website. However, this copy is accessible to Ghost Inspector. Simply record your tests using this ngrok.io URL and Ghost Inspector will be able to access your website and execute them.

You can exit the ngrok process at anytime to disconnect the tunnel. When you wish to run your Ghost Inspector tests again, start ngrok back up using the same command above.

Note: Each time you restart ngrok, a new URL will be provided. You can use the “Run with Custom Settings…” option in our application to quickly override your test(s) start URL with this new ngrok.io URL:
Run Test with Custom Settings... Run Test with Custom Settings...