akaunting / laravel-firewall

Web Application Firewall (WAF) package for Laravel
https://akaunting.com
MIT License
943 stars 106 forks source link

API return #38

Closed robov closed 3 years ago

robov commented 3 years ago

Awesome package, and i really love it. When an IP is blocked it shows nicely the "blocked" view

However, sometimes I call the backend through axios and then I get the view back in the console. Any suggestions what the best way of communication to the user is with API calls

As far as I can see in the code I cannot change the response based on a api call or a http call

Suggestion Maybe in the middleware.php determine if the call was an api and then use different config parameters to return then on a blocked api call the frontend can determine the error and show a message to the user / or redirect with js

denisdulici commented 3 years ago

Glad to see you like the package 😉

I don't think there is an easy way to find if the request is an API call but feel free to send a PR for any kind of solution.