Skip to content

Instantly share code, notes, and snippets.

Created Aug 15, 2018
What would you like to do?
proxy React Native bandler to other compouter

I wokr on Linux and how I can test on IPhone?

This server.js I run on MacOS

Then all changes when I do on linux automatically apply on simulator on MacOS


On Linux

react-native run-andriod && react-native start

On MacOS

node server.js && react-native run-ios
const http = require('http');
const httpProxy = require('http-proxy');

const PORT = 8081;
const target = {
  host: '', // change to Linux computer IP in local network
  port: 8081
const proxy = new httpProxy.createProxyServer({target});
const proxyServer = http.createServer((req, res) => proxy.web(req, res));

// Listen to the upgrade event and proxy the
// WebSocket requests as well.
proxyServer.on('upgrade', (req, socket, head) =>, socket, head));


console.log(`Proxy server listen ${PORT} port`);
console.log(`${}:${target.port} => localhost:${PORT}`);

This comment has been minimized.

Copy link
Owner Author

@retyui retyui commented Aug 15, 2018

All functions remote debug, hot/live reload WORK!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment