Expo Tunnel
Tunneling in Expo React Native
Blogged By
Chitranjan Gupta@chitranjan-gupta
WAN - Wide Area Network i.e. Internet
Running on Android over WAN using ngrok
- Install ngrok on System (Linux)
- Forward the port 8081 using ngrok
ngrok http 8081
- Add the forwarded url in the terminal
export EXPO_PACKAGER_PROXY_URL=https://a1cc-104-199-117-204.ngrok-free.app
- Run the Expo server
npx expo start
- Install Expo Go Android App
- Paste the url
exp://a1cc-104-199-117-204.ngrok-free.app
Running on Android over WAN using Gitpod Workspace
- Export port 8081 in PORTS section of terminal and make it PUBLIC
- Add the url in the terminal
export EXPO_PACKAGER_PROXY_URL=https://8081-chitranjangupta-project-hmc2iztl9q7.ws-us108.gitpod.io
- Run the Expo server
npx expo start
- Install Expo Go Android App
- Paste the url
exp://8081-chitranjangupta-project-hmc2iztl9q7.ws-us108.gitpod.io
Running on Android over WAN using Github Codespace
- Export port 8081 in PORTS section of terminal and make it PUBLIC
- Add the url in the terminal
export EXPO_PACKAGER_PROXY_URL=https://cuddly-fiesta-rrw5v9vw55vc5754-8081.app.github.dev
- Run the Expo server
npx expo start
- Install Expo Go Android App
- Paste the url
exp://cuddly-fiesta-rrw5v9vw55vc5754-8081.app.github.dev
Running on Android over WAN using Expo Tunnel
- Run this command
npx expo start --tunnel
this will ask you to install@expo/ngrok
npm package in global scope - Press
y
to install - Install Expo Go Android App
- Paste url
exp://sfff545-newwd.exp.direct
The Fast Refresh does not work on https connection because the websocket ssl termination does not work. Therefore to use fast refresh we have to connect using http connection. The
npx expo start --tunnel
start an http tunnel so it works without any configuration but withExpo Go
only when it starts indevelopment build
it starts an https connection. So workaround this problem given below is solution.
Follow this instruction for development build to enable fast refresh
- Install the
ngrok
npm module globallynpm i -g ngrok
- Set the auth token for ngrok because it will not work without authtoken
ngrok config add authtoken <TOKEN>
- We have to downgrade ngrok http connection because by default with https
ngrok http --scheme=http 8081
- then Add the url in the terminal
export EXPO_PACKAGER_PROXY_URL=http://a1cc-104-199-117-204.ngrok-free.app
- Run the Expo server
npx expo start
- Install Expo Go Android App
- Paste url
http://a1cc-104-199-117-204.ngrok-free.app
Sources: