I have a pretty unique predicament here. I'm using Twilio and need to test my Twiml response on my local machine. The goto solution for that is ngrok, but the problem is that the site I'm working on relies on subdomains for proper routing. There is no mysite.com, only sub.mysite.com. In the local environment I've modified hosts to redirect sub.mysite.dev to 127.0.0.1, but I haven't a clue how to solve this over a tunnel. Any thoughts?

有帮助吗?

解决方案

I'm the creator of ngrok.

You can still make this work with ngrok, you'll just need to decide on a few subdomains up front that you want to use for testing. ngrok lets you forward multiple tunnels via the configuration file (https://ngrok.com/usage#config) Example configuration file:

tunnels:
  one.mysite:
    proto:
      http: 80
  two.mysite:
    proto:
      http: 80
  three.mysite:
    proto:
      http: 80

This will forward

one.mysite.ngrok.com -> 127.0.0.1:80

two.mysite.ngrok.com -> 127.0.0.1:80

three.mysite.ngrok.com -> 127.0.0.1:80

It's not a wildcard (ngrok doesn't support wildcards at the moment), but having a few subdomains setup should be good enough for testing, I imagine.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top