This question is the follow up of button click not work on mobile in React web app?
So I tried remote debugging then found out that is not the button that did not work , it's my API request did not send , but in my computer it still works which is very odd...
My request is http://localhost:3001/..... , I wonder it's because I use localhost instead of http://vpsDomain:3001/... , but it does not make sense since it's on the same domain , so localhost supposed to work ( and it works on my computer)
Did anyone encounter this kind of problem ?
I skipped pasting code since I don't think is the code that cause the problem , because It worked on my computer , so I think is the network or something I don't know about mobile connection
CodePudding user response:
If you use localhost, it will use the localhost of the current device, so when using from your computer is uses your computers localhost (which you probably have running and that’s why it works). If you use localhost in a request on your phone the request will use the localhost of your phone so not the server running on your computer. You should use your domain (http://vpsdomain:3001/...) for cross device acces