XMLHttpRequest cannot load . Response for preflight has invalid HTTP status code 500


Hi guys, i have issue when trying to POST a JSON to my api, i tested my api with POSTMAN
and work fine i get the 200 status, but probléme is with chrome or mozilla i obtain this error msg every time and i have actived CORS plugin in brower there is any solution plz



It’s on your Server Site 5xx means something on the Server.
Please check your server code for bugs and your server log files for errors.


i don’t know where is error im my endpoint i call function who register_user to database

the register_user method call to add_user of a loaded model

public function add_user($data) {
$last_id = $this->db->insert($this->table, $data);
return $last_id ;

whith that iget th 500 error, but when i remove the insert inscruction that’s work without error 500

public function add_user($data) {
return $data ;

too strange


I can’t see the problem i your code, maybe your logfiles can help? try searching on your favorite search engine on how to get your php logs on your system


i fixed it by little modify in .htacces thnks