CodeIgniter Forums
HTML 303 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: HTML 303 (/showthread.php?tid=86806)



HTML 303 - chaos - 02-18-2023

Hi, i am trying to integrate a payment system and i am required to write a callback page that returns HTML code 200.
this is the controller i wrote as an example

Code:
public function callback()
{
return 1;
}

Route: https::/example.com/public/index.php/[controller]/callback

but i am getting this in access.log:

1.1.1.1 - - [18/Feb/2023:01:52:36 -0800] "POST /public/index.php/[controller]/callback HTTP/1.1" 303 5361 "-" "-"

What am i doing wrong? how can I make the controller return a 200 status?

thanks


RE: HTML 303 - chaos - 02-19-2023

UPDATE: I found out that the Filter CSRF was causing the redirect. Now i have to find how to exclude some routes form the filter CSRF.


RE: HTML 303 - Mobostar - 02-19-2023

(02-19-2023, 01:01 PM)chaos Wrote: UPDATE: I found out that the Filter CSRF was causing the redirect. Now i have to find how to exclude some routes form the filter CSRF.

You can exclude some routes like this:
PHP Code:
    public $globals = [
        'before' => [
            'csrf' => ['except' => ['api/*''search']],
        ],
        'after' => [
            'toolbar',
        ],
    ]; 

In this example, CSRF will not work for all URIs that start with"api/" and "search" URI.


RE: HTML 303 - kenjis - 02-19-2023

See https://codeigniter4.github.io/CodeIgniter4/incoming/filters.html#globals