skip to Main Content

I’m fairly new to the webdev. I have a React frontend built with Vite, and a Node.js backend that uses MongoDB. I finished my little project and when It came to deploy it to my Linux server, I got confused about how to handle API calls.

Is there any way to hide API URL’s on frontend apps? Because everything is done in client side, and frontend is basically an interface between user and backend, that should be impossible. But how does for example, big companies like Facebook handle this? If I go to Facebook and inspect the code, can I find the exact IP and API address that facebook backend serves me the posts? Or are there any tricks to make this more secure? What are the industry standards are on this topic?

2

Answers


  1. The interface between your web application in the browser and your backend service is HTTP(s). There are HTTP verbs such as GET, POST, DELETE, etc. You can pass argument or information to your backend services via query parameters which are visible in the URL, or you can send it in the body of a request. An HTTP POST, for example would have a body that is not seen or viewable unless the end user made specific effort to view it.

    Login or Signup to reply.
  2. Its not possible to make API calls completely unreadable from the browser.

    However, there are a few techniques you can use to make it more difficult for attackers to understand and exploit the API calls.

    • Obfuscation: You can use ‘js-obfuscator’
    • Encryption: You can use ‘crypto-js’
    • Build tools: You can use ‘webpack’ or ‘gulp’
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search