codeigniter4 / CodeIgniter4

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
5.38k stars 1.9k forks source link

Bug: I have a 500 error even though I have no error #7105

Closed ALTITUDE-DEV-FR closed 1 year ago

ALTITUDE-DEV-FR commented 1 year ago

PHP Version

8.2

CodeIgniter4 Version

4.1.12

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows, Linux

Which server did you use?

apache

Database

MYSQL 5.6

What happened?

I started to develop my own CMS, it works perfectly, fast, secure etc, I even have security scores in A+ and 100% on Google Insight, however according to some tools like GT METRIX or Chromes extensions it tells me that my site is in error 500, except that this is not the case, I do not know where to find this kind of concerns.

Link to test : https://dev01.altitude-dev.com/

Steps to Reproduce

Just load the website and check.

Network console, no errors.. Google Insight same GtMetrix detect a error 500 and others apps.

Expected Output

Error 500 in tools.

Anything else?

No response

datamweb commented 1 year ago

7093 ?

ALTITUDE-DEV-FR commented 1 year ago

7093 ?

I use this, its a problem ?

`

RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L]

<IfModule !mod_rewrite.c> ErrorDocument 404 /index.php

# force compression for clients that mangle 'Accept-Encoding' request headers SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" Header set X-Content-Type-Options "nosniff" Header set X-Xss-Protection "1; mode=block" Header set X-Frame-Options "SAMEORIGIN" Header set Referrer-Policy "strict-origin-when-cross-origin" Header set Permissions-Policy "geolocation=self" Header always set Content-Security-Policy "font-src *; form-action 'self'; object-src 'none'; base-uri 'none'; frame-ancestors" `
kenjis commented 1 year ago

I got Whoops! page at the first visit. But I reloaded, your site looks great.

Check your web server log and CodeIgniter log to get the reason of 500 errors.

ALTITUDE-DEV-FR commented 1 year ago

I got Whoops! page at the first visit. But I reloaded, your site looks great.

Check your web server log and CodeIgniter log to get the reason of 500 errors.

Its my problem i have any problem :( any logs in my project :( localhost or live.. is verry obscur bug :D

datamweb commented 1 year ago

I got Whoops! page at the first visit. But I reloaded, your site looks great.

Yes , Whoops ,after normal.

ALTITUDE-DEV-FR commented 1 year ago

I have check my log server, no errors detected, and no logs in server live with errors, and no log created in the writable folder.. Throttle is the problem ?

ALTITUDE-DEV-FR commented 1 year ago

I mso sorry is my fault, i have make a verification "banned" user IP its make the problem.. Solved

kenjis commented 1 year ago

If you implement like this https://codeigniter4.github.io/CodeIgniter4/libraries/throttler.html#the-code the response code is 429, not 500.

ALTITUDE-DEV-FR commented 1 year ago

If you implement like this https://codeigniter4.github.io/CodeIgniter4/libraries/throttler.html#the-code the response code is 429, not 500.

Small question with Throttler, how to define time lock user, example i have made this :

    // -- Antispam & ForceBrute --

    $throttler  = \Config\Services::throttler();
    $allow      = $throttler->check('perform', 4, MINUTE);

    How to lock user for 5 minutes ?
kenjis commented 1 year ago

See https://github.com/codeigniter4/shield/blob/develop/src/Filters/AuthRates.php#L38 This is sample code for rate limit to an IP address.

ALTITUDE-DEV-FR commented 1 year ago

Wow, I've never had such a fast and competent support in the development world, thank you very much for your help and long life to CI!