You could add your domain the the allowed_origins array in config/cors.php. Something along the lines of:
'allowed_origins' => ['*example.com'],
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a Laravel back-end API which is meant / intended for my website application to use. Its a public API in the sense that parts of the website will be accessing the API without login requirements.
So for example anyone can go to the site click"rates" and it will make the API call and return rates, in the sense its public / no auth needed since this part of the site is public.
But how can i prevent other people / sites from simply making the same request to that API endpoint and highjacking the data from my server for their use?
Basically I would like to API accept requests that only come from my website.
The secured API endpoints are protected when a user logs in and JWT's come into play.
Please or to participate in this conversation.