Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

qasimalbaqali's avatar

Hide /api/ endpoints when accessing through web

I created my api on Laravel using Dingo. The api is to be accessed by mobile applications and other clients. I have a website running with some static pages, and the api is also hosted on the same domain. When navigating through any of the api endpoints I would get messages such as 404 not found in JSON (the api is returning it), or I could access an endpoint that would return results that is supposed to be called from a 3rd party client. How can I 'hide' those endpoints from being accessed by a browser? Maybe a redirect to the home pages?

0 likes
0 replies

Please or to participate in this conversation.