Ngrok: Using grok with local subdomain

Created on 22 Jul 2014  路  7Comments  路  Source: inconshreveable/ngrok

Hey. I paid, so I feel okay about asking what may be a stupid question. :)

Okay, so I am developing a Rails application locally. It uses custom subdomains. So when I start my rails server and visit foo.myapp.dev:3000 I see the correct view for the foo account.

So now I want to use ngrok so I can see this in Virtual Box (yep, I'm doing IE layout fixes), but I'm not sure how to do it.

I tried this:
~/Sites/ngrok foo.myapp.dev:3000
which starts ngrok fine, but no dice.

Can anybody point me in the right direction?

Thanks

Most helpful comment

For unpaid users:
ngrok http -host-header=rewrite [your-custom-local-domain]:[port]

All 7 comments

ngrok doesn't modify any traffic passing over the tunnel. Including the Host header that some web servers use for routing you to the right site.

I'm guessing you're using Pow if you're doing rails, in which case this will probably be helpful:
http://journal.wearebunker.com/post/59684890589/using-ngrok-with-pow-for-development-previews

If not, ngrok's FAQ has instruction on how to make this work with Apache or Nginx:
https://ngrok.com/faq

Just to be more clear, development servers relying on the Host header will be looking for requests that have a Host header like:

GET / HTTP/1.1
Host: foo.myapp.dev

Instead it's getting:

GET / HTTP/1.1
Host: 3c9af0e.ngrok.com

Future versions of ngrok will automatically rewrite the Header for you.

Not using Pow.

Just have 127.0.0.1 foo.myapp.dev in /etc/hosts

I seem to have figured it out. Just used a custom subdomain in ngrok, and my application has picked it up. So in my example case ~/Sites/ngrok -subdomain foo 3000 has done the trick.

Thanks for the lightning quick response though. :+1:

For unpaid users:
ngrok http -host-header=rewrite [your-custom-local-domain]:[port]

Unpaid users and others can use this gist as well

nice! Thanks

For unpaid users:
ngrok http -host-header=rewrite [your-custom-local-domain]:[port]

Thank you! :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

patcoll picture patcoll  路  5Comments

megapctr picture megapctr  路  4Comments

alexforever86 picture alexforever86  路  5Comments

ricardoasc picture ricardoasc  路  5Comments

lukewlms picture lukewlms  路  12Comments