Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 389
Poorya Avatar asked Nov 27 '22 23:11

Poorya


2 Answers

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

./ngrok http --host-header=rewrite myname.test:80
like image 194
Flex Elektro Deimling Avatar answered Dec 06 '22 06:12

Flex Elektro Deimling


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!

like image 42
John Shipp Avatar answered Dec 06 '22 06:12

John Shipp