Tushar Bhutada
Tushar Bhutada

Reputation: 41

How to use ngrok with puma-dev rails server

My rails app is spin up using puma-dev on Ubuntu.

I'm using puma-dev command to start my app (in foreground) and then access the rails app using https://app.test:9283. As the puma-dev is running in the foreground I have to use the port 9283 to access the port.

Now I want to access the rails app on remote machines like a mobile device or other PC. So have to use the ngrok to do so. I have installed ngrok in my ubuntu but I'm not able to access my localhost setup running on https://app.test:9283 using ngrok. Any help would be appreciated!

NOTE: When I use ./ngrok http 80 it successfully redirects me to localhost:80 which means ngrok is working properly.

Upvotes: 4

Views: 1723

Answers (4)

Oleksandr Danylchenko
Oleksandr Danylchenko

Reputation: 697

The only way I was able to connect to my locally running app securely was by running the next command:

ngrok http https://app.localhost --host-header app.localhost

without any ports and the https:// address before the --host-header

Upvotes: 0

Andrew Benton
Andrew Benton

Reputation: 71

You need "local-leg HTTPS."

./ngrok http https://app.test:9283

Upvotes: 0

mrt
mrt

Reputation: 1749

With puma-dev it is necessary to include the -host-header argument, like so:

./ngrok http -host-header=app.test 9283

Upvotes: 4

Priyanka
Priyanka

Reputation: 59

you have to bind the ngrok server with the same port as rails server ./ngrok http 9283

Upvotes: 0

Related Questions