react-native-static-server
react-native-static-server copied to clipboard
Android - It is starting on 192.*.*.* and not on localhost
Hi there,
On Android, I am trying to host a staic server on localhost, i have remote debugging enabled, but i also tried with it disabled.
Is there anyway to force it on localhost? Is this only happening cuz im in dev mode?
Or any way to force it to use 127.0.0.1
because I am using this for oauth page on google and it only accept localhost or 127.0.0.1
Did you find any solution about this issue @Noitidart ?
Regards
@GregoryBabonaux no I couldnt find a solution. It was a major problem I was having and ended requesting approvals to completely changing my architecture to avoid a local server localhost. (Not being at localhost, caused some issues down the line.)
Thanks for your feedback
I think the problem is this plugin need a real network to work properly. So it needs a DHCP who provide a real ip address, not a localhost / 127.0.0.1 of the device
I’ve the same issue when i want to run my app without wifi
Regards
Check https://github.com/futurepress/react-native-static-server/blob/master/android/src/main/java/com/futurepress/staticserver/FPStaticServerModule.java#L31
Haven't tried it yet, but we got a localhost_only bool there ;)
Check https://github.com/futurepress/react-native-static-server/blob/master/android/src/main/java/com/futurepress/staticserver/FPStaticServerModule.java#L31
Haven't tried it yet, but we got a localhost_only bool there ;)
I was facing the same issue and this lead me to the solution:
This parameter is taken from the options-parameter. If you start the server to be available inside the app only, it will use localhost, otherwise it has to search for an available IP address. So if you need localhost as Server-Url, you have to make it available only inside the app on Android (paramter localOnly
)