'ngrok not working with mamp

I am using MAMP Pro as development environment. I have used ngrok with MAMP before. however in this particular situation it redirects from the ngrok url to my local url and https is not available .

my local server is e-kyc.dev and im using ngrok http -host-header=e-kyc.dev 80 to run ngrok. enter image description here however when im using https:/a95118d9.ngrok.io it loads the welcome page(wihtout ssl) and once I click on a link it will redirect to a local url like e-kyc.dev/login instead of https:/a95118d9.ngrok.io/login

NOTE: my server works as expected locally, also functioning properly while using xip.io(for Lan) and selfsigned SSL.



Solution 1:[1]

for me the option --host-header=rewrite did work out:

./ngrok http --host-header=rewrite myname.test:80

Solution 2:[2]

Two ways to fix this:

First, the free way:

  1. In MAMP, go to your hosts and turn off the built in SSL.
  2. In MAMP, for that host, change the port for that host to something other than 80 (I used 8080).
  3. Open your terminal and navigate to the public directory for the web app. Run ngrok http 8080 from inside the public directory.
  4. Grab the https path provided by ngrok and you should have success.

Next, the paid way:

  1. Upgrate ngrok to the pro or business plan
  2. Use tls ngrok tls -subdomain=encrypted 443

... I'm assuming that the OP wants to go the free route. Hope this helps!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 John Shipp