Using ngrok to access multiple homestead sites remotely

ngrok can be used to provide access to a local homestead or vagrant site remotely i.e. to a client.

You need to use header rewriting to work with the homestead configuration, the syntax for using a single site looks like:

ngrok http -host-header=rewrite mysite.app:80

If you have multiple sites then you will need to use ngrok with a config file, stored in ~/.ngrox.config.yml. The docs are vague on how to do the rewriting in the config file so here it is for reference:

tunnels:
    mysite:
        addr: mysite.app:80
        proto: http
        host_header: rewrite
    myapi:
        addr: myapi.app:80
        proto: http
        host_header: rewrite

Note that host header rewriting doesn’t work nicely with cookies which seriously limits this.

See http://stackoverflow.com/questions/41523847/fail-to-create-cookies-while-using-ngrok-with-header-rewrite

One Reply to “Using ngrok to access multiple homestead sites remotely”

  1. Hey,

    Thanks for your post.

    Currently struggling into an issue with that kind of configuration. I can access my vhost through ngrok, however I can’t initiate sessions.

    It looks like cookies sessions can’t be set, do you know if the rewrite option of ngrok also rewrite the cookie domain ?

    Do you successfully initiate sessions or log into applications with ngrok ?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA - answer the question below to prove you are human *