Home > Software engineering >  How can we isolate API urls in the frontend of a React App?
How can we isolate API urls in the frontend of a React App?

Time:11-08

I just started learning React and I thought of making a simple app where I will have some API endpoints and the frontend will hit them with GET/POST requests. But how can I hide those API urls from other users i.e anyone can open DevTools, find the API url and misuse it.

Any help is appreciated.

CodePudding user response:

I don't think there's a way to hide API endpoints in the way you are suggesting. Security measures would have to be implemented in the back end in order to prevent misuse.

CodePudding user response:

You can set cors with configurations on backend so that backend will on respond only to specific domains. But if the endpoint is public then

  • Related