How do I hide a REST API Url from the end user?

后端 未结 7 1837
庸人自扰
庸人自扰 2021-02-07 15:13

Is it possible to hide my REST URL that I using via AJAX to populate page data? I don\'t want others taking and consuming from my REST API, but need to use it to display content

7条回答
  •  天涯浪人
    2021-02-07 16:03

    Not really. The page needs to have access to the URL in order to use it, and this gets you into the age-old problem of showing somebody something while hiding it from them at the same time. Modern browsers with built-in debugging tools compound the problem: even if you encrypt the URL, there comes a point where you will have to decrypt it in order to use it, and debuggers can jump in at that point.

    Is there a particular reason that you're concerned about others using the API? There isn't really a way to prevent others from finding the URL, but there may be other ways to achieve your goal.

提交回复
热议问题