-1

I am trying to access node js api which works on host/localhost machine. While accessing from other devices using ngrok or IPv4 link it shows UI of the website correctly but the API doesn't works functionally(e.g. user login). By clicking Login button in vscode API terminal doesn't get any request which is called successfully from localhost machine. How do I solve this issue to work functionally from other devices too?

Sudhir S Pawar
  • 45
  • 1
  • 11

1 Answers1

0

If you're using ngrok for this you may need another tunnel for the API, unless both the UI and API are served from 127.0.0.1:5000.

If they are served from the same service port then your single ngrok tunnel should work for HTTP transport to both. You would either need to alter your API calls so that the hostname is your tunnel's hostname, or you could just make your API calls with relative URLs. For example the API could make a request to /api/resource rather than 127.0.0.1:5000/api/resource.