We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8.2
4.6.0
Composer (using codeigniter4/appstarter)
codeigniter4/appstarter
Windows
apache
mysql
I am using CodeIgniter 4 for the backend as an API for a Vue.js site, but I am encountering a CORS error when trying to communicate between them.
How can I fix this issue?
I have already applied the following configurations:
Cors.php file
public array $api = [ 'allowedOrigins' => ['http://localhost:5173'], 'allowedOriginsPatterns' => [], 'supportsCredentials' => false, 'allowedHeaders' => ['Authorization', 'Content-Type','X-Requested-With'], 'exposedHeaders' => [], 'allowedMethods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'], 'maxAge' => 7200, ];
Routes file
$routes->group('api/v1', ['namespace' => 'App\Controllers\Api','filter'=>'cors:api'], function (RouteCollection $routes) { $routes->match(['post', 'options'], 'auth/signup', 'AuthController::signup', ['as' => 'api_signup']); });
Controller Class I am using:
class AuthController extends ResourceController
However, I am still getting a CORS error, and I can't resolve it.
For running the backend and frontend, I use:
php spark serve npm run dev
No response
The text was updated successfully, but these errors were encountered:
Is this your case #9437 ?
Sorry, something went wrong.
No branches or pull requests
PHP Version
8.2
CodeIgniter4 Version
4.6.0
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
mysql
What happened?
I am using CodeIgniter 4 for the backend as an API for a Vue.js site, but I am encountering a CORS error when trying to communicate between them.
How can I fix this issue?
Steps to Reproduce
I have already applied the following configurations:
Cors.php file
Routes file
Controller Class
I am using:
class AuthController extends ResourceController
However, I am still getting a CORS error, and I can't resolve it.
For running the backend and frontend, I use:
Expected Output
Anything else?
No response
The text was updated successfully, but these errors were encountered: