Proxying of port does not work for React Native (Expo) apps
See original GitHub issueI have read gone through many docs of code-server about the proxying of port. The syntax for that is
https://address-of-code-server/proxy/19002
But in the case of metro apps, it does not work. Let me attach a screenshot for better reference. Any help in this case would be pretty helpful.
FYI: I know I can expose the ports like 19002
that expo uses, but that would not be the end solution, hence I want to go forward with proxying. (Also, to expose a port on my docker container, would require rebuilding it and it would take a time and effort for me atleast.)
Tagging few whom I know helpful in this organisation, @jsjoeio @bpmct @code-asher
[SCREENSHOT OF INITIALISING A BLANK REACT NATIVE PROJECT]
[SCREENSHOT OF THE EXPO APP BEEN BUILT AND EXPOSING THE DEV TOOLS ON http://localhost:19002
]
[SCREENSHOT OF EXPO DEV TOOLS ON BROWSER VIA code-server PROXY]
Here, it seems like, the page title
is being loaded as it is evident, but somehow the page content is not being served, Things might be related to Next.js as expo uses Next.js to serve the dev tools in the browser.
[SCREENSHOT OF THE NETWORK TAB LOADING THE FILES FROM THE DEV SERVER]
Any help would be very helpful, thank you!
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
I was also having a similar issue,
I created a webpack.config.js file with following content:
Then after that it started working, You might get some “watchers limit reached” if you are running a ubuntu docker image like me but this was easy to fix with a few commands to raise the limit.
I think that makes sense since Expo sees /absproxy/19002 and that path doesn’t exist.
From here we would need to configure Expo to understand that /absproxy/19002 is the base path but they don’t seem to have any documentation on how to do that.
It looks like it uses Webpack so I tried to set the public path but I didn’t have any luck. I found an upstream issue about it though; it seems they hardcode
/
: https://github.com/expo/expo-cli/issues/3092