![]() |
Hey Guys,
im still new to web development so please dont judge me ![]() Ive been trying to create a RESTful API with Ci4 and the frontend is VueJs3. The frontend has the url "beta.example.de" and the API is another subdomain "api.example.de" This is my Filter: PHP Code: <?php namespace App\Filters; Code: const guest = axios.create({ If anyone could tell me what Im missing here it would be very much appreciated. Nevermind guys... In the Filters.php I simply wrote " PHP Code: 'cors' => CORS::Class, Apparently I hat to specify the path as " Code: 'cors' => \App\Filters\CORS::class,
08-21-2023, 09:09 PM
(This post was last modified: 08-21-2023, 09:40 PM by InsiteFX. Edit Reason: added CORS code )
Dont use the * on a live web site:
Code: Header set Access-Control-Allow-Origin "*" Code: ## .htaccess Control For CORS Configuration See if that shows you whats wrong. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(08-21-2023, 09:09 PM)InsiteFX Wrote: Dont use the * on a live web site: Hi @InsiteFX , You're right, it's not correct to use * on a live website but do you have any experience for mobile apps? AFAIK they do not have any specific url/domain etc. How can we allow only for our mobile app?
App is not required by CORS, it is only for browsers. There is an exception when the app is a web client
[quote pid="411990" dateline="1692698256"]
Any non-conforming client (such as in a mobile app, or just a shell script invoking curl ), can and usually will completely ignore CORS. Such clients don't have a Same-Origin Policy to begin with, so there's nothing for CORS to make holes in and therefore it does nothing. -------------------------------------------------------------------------------------------------------------------------------------------- [/quote] (08-22-2023, 02:57 AM)demyr Wrote:(08-21-2023, 09:09 PM)InsiteFX Wrote: Dont use the * on a live web site: What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |