Skip to content

Cheatsheet for ngrok with domain name / subdomain name / bare bones server - not docker. #184

@johndpope

Description

@johndpope

Running with localhost is fine with docker -
I need some hand holding with a domain name.

I'm ok to not use domain name and use ngrok subdomain - I'm easy - just need this to work for client.

Setting up ngrok is not trivial.
https://dashboard.ngrok.com/endpoints/domains

There's some choices with plans -
the configuration and commands is not so straightforward.

so I think the ngrok subdomain is ok - I purchased this

I run the ngrok command to update the auth token as spelled out in the ngrok dashboard.

then run
./ngrok http --region=us --hostname=YOURSUBDOMAINHERE.ngrok.io 80
Screen Shot 2021-10-19 at 9 01 05 pm

should that be port 80???

UPDATE - digging into the docker compose I can see it should route to port 5000 -
that makes sense.

command: ["ngrok", "http", "server:5000"]

./ngrok http --region=us --hostname=YOURSUBDOMAINHERE.ngrok.io 5000

I think it's better to use ngrok server name alias on server to point to localhost - than change the name.

/etc/hosts
127.0.0.1   ngrok
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost6 localhost6.localdomain6

UPDATE
this line
https://github.com/plaid/pattern/blob/master/client/src/components/Sockets.jsx#L15

socket.current = io(`localhost:${REACT_APP_SERVER_PORT}`);

needs some documentation - this is appropriate for running ngrok locally - but will fail unless it's updated to subdomain / domain name.

UPDATE
I update connection to use https - and some Mixed Content / secure /insecure errors disappeared.


 socket.current = io('https://YOURSUBDOMAINHERE.ngrok.io/', {
      transports: ['websocket'],
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions