Search code examples
iis-expressngrok

Ngrok configure multiple port in same domain


Is it possible to open multiples ports in ngrok in same domain?

Something like:

Fowarding http://example.ngrok.com:50001 -> 127.0.0.1:50001

Fowarding http://example.ngrok.com:50002 -> 127.0.0.1:50002

I´m working in windows and it'll be useful for debuging with IIS Express


Solution

  • Yes, it is possible using multiple simultaneous tunnels, within the same hostname !

    All you need to do, is to declare them on your configuration file, like this:

    authtoken: 4nq9771bPxe8ctg7LKr_2ClH7Y15Zqe4bWLWF9p
    tunnels:
      first-app:
        addr: 50001
        proto: http
        hostname: example.ngrok.com
        host_header: first-app.example.ngrok.com
      second-app:
        addr: 50002
        proto: http
        hostname: example.ngrok.com
        host_header: second-app.example.ngrok.com        
    

    And run them with:

    ngrok start --all
    

    Look on the documentation for options, like hostname, subdomain, authtoken and host_header. Hope this help you !

    P.S For Free plan remove custom host and header part like this it will be different domains FYI.

    authtoken: 6yMXA63qefMZqCWSCHaaYq_5LufcciP1rG4LCZETjC6V
    tunnels:
      first:
        addr: 3002
        proto: http    
      second:
        addr: 8080
        proto: http
    

    NOTES: