Why donate
API Explorer
Upgrade guide
NEW!
The quasar.config file
Convert to CLI with Webpack
Browser Compatibility
Supporting TypeScript
Directory Structure
Commands List
CSS Preprocessors
Routing
Lazy Loading - Code Splitting
Handling Assets
Boot Files
Prefetch Feature
API Proxying
Handling Webpack
Handling process.env
State Management with Pinia
State Management with Vuex
Linter
Testing & Auditing
Developing Mobile Apps
Ajax Requests
Opening Dev Server To Public
Quasar CLI with Webpack - @quasar/app-webpack
Opening Your Dev Server to the Public

At some point you may want to show someone else the project you’ve been working on. Fortunately, there are a couple of good tools to accomplish this, localhost.run and Ngrok. Both create a tunnel to your dev server and (by default) auto-generate an internet address on their respective servers to offer to your clients or anyone special you’d like to show your work to.

WARNING

Opening your dev server to the public poses security risks. Be absolutely cautious when using tools like this.

When you’ve finished with your demonstration or testing, make sure to stop localhost.run or ngrok. This will prevent any unwanted access of your computer through them.

Using Tunnelmole

Tunnelmole will work on any machine with NodeJS 16+ installed and has no non-JavaScript dependencies.

First, install tunnelmole package globally:


$ yarn global add tunnelmole

Then, assuming you are running quasar on port 80, run the following:

$ tmole 80

If your port is different to 80, change 80 to your port.

Here’s the full command with output:

$ tmole 80
http://b8ootd-ip-157-211-195-182.tunnelmole.com is forwarding to localhost:80
https://b8ootd-ip-157-211-195-182.tunnelmole.com is forwarding to localhost:80

If you are self hosting your own Tunnelmole service or you have a set an API key for the official service, you can run the following to use a custom subdomain (again, replace 80 with your port if it is different).

$ tmole 80 as mysubdomain.tunnelmole.com

Its also possible to launch tunnelmole from code if you add it as a dependency to your project (yarn add --dev tunnelmole or npm i --save-dev tunnelmole or pnpm/bun equivalents)

First import tunnelmole. Both ES and CommonJS modules are supported.

Importing tunnelmole as an ES module

// import as ESM:
import { tunnelmole } from 'tunnelmole';

// or import as CommonJS module:
const tunnelmole = require('tunnelmole/cjs');

Once the module is imported you can start tunnelmole with the code below, changing port 80 to the port your application listens on if it is different.

const url = await tunnelmole({
    port: 80
    // Optionally, add "domain: 'mysubdomain.tunnelmole.com'" if using a custom subdomain
});
// url = https://idsq6j-ip-157-211-195-169.tunnelmole.com

Using localhost.run

  1. Assuming you have an SSH shell, you only need issue the following command (substituting your details)
$ ssh -R 80:localhost:8080 ssh.localhost.run
# In case your development server doesn't run on port 8080 you need to change the number to the correct port
  1. That’s it, and you will now have a random subdomain based on your current system username assigned to you like so:
$ ssh -R 80:localhost:8080 ssh.localhost.run
Connect to http://fakeusername-random4chars.localhost.run or https://fakeusername-random4chars.localhost.run
Press ctrl-c to quit.

It’s not currently possible to request your own subdomain.

Using Ngrok

  1. Download and install ngrok here. (Please note that the ngrok executable file does not need to be placed in or run from inside your cordova folder. When on a mac it’s best to place the ngrok executable file inside /usr/local/bin to be able to run it globally.)

  2. Start your Dev server

$ quasar dev
  1. Create your ngrok connection
$ ngrok http 8080
# In case your development server doesn't run on port 8080 you need to change the number to the correct port
  1. ngrok shows the url in the command line when it started.
Tunnel Status                 online
Version                       2.0/2.0
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://92832de0.ngrok.io -> localhost:8080
Forwarding                    https://92832de0.ngrok.io -> localhost:8080

Connections                  ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00

Please be careful as the ‘Forwarding’ URL will be accessible to anyone until this connection is closed again.

Inspecting traffic

When running ngrok, visit http://localhost:4040 to inspect the traffic.

This tool allows for custom domains, password protection and a lot more. If you require further assistance, please refer to the ngrok docs for more information.