Welcome Guest, Not a member yet? Register   Sign In
Filter Customization for disallowed characters
#1

Hello everyone. There was a problem with customizing the filter for disallowed characters. If I understand correctly, the exception is triggered before the standard filters are applied. 

PHP Code:
public function before(RequestInterface $request$arguments null)
    {
        $uri $request->getUri()->getPath();

        if ( ! preg_match('/^[' config(App::class)->permittedURIChars ']+$/i'$uri)) {
            if ($request->getUri()->getSegment(1) === 'api') {
                return Services::response()->setStatusCode(404);
            }

            return redirect()->to('/page-404');
        }
    

in App/Config/Filters
PHP Code:
public array $globals = [
        'before' => [
            // 'honeypot',
            // 'csrf',
            // 'invalidchars',
            'uri'
        ],
        'after'  => [
            // 'honeypot',
            // 'secureheaders',
        ],
    ]; 

The code of my filter is shown below. How to solve this problem correctly without violating the logic of the framework?
Reply


Messages In This Thread
Filter Customization for disallowed characters - by Avega Soft - 07-13-2024, 02:49 AM



Theme © iAndrew 2016 - Forum software by © MyBB