2020-10-12 14:00:09 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
2021-10-15 23:46:21 +02:00
|
|
|
use Illuminate\Support\Facades\Log;
|
2020-10-12 14:00:09 +02:00
|
|
|
|
2022-03-29 15:02:43 +02:00
|
|
|
class RejectIfReverseProxy
|
2020-10-12 14:00:09 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle($request, Closure $next)
|
|
|
|
{
|
2022-03-29 15:02:43 +02:00
|
|
|
if (config('auth.defaults.guard') === 'reverse-proxy-guard') {
|
2022-10-18 17:34:56 +02:00
|
|
|
Log::info('Cannot request this action in Demo mode');
|
2020-10-12 14:00:09 +02:00
|
|
|
|
2022-03-29 15:02:43 +02:00
|
|
|
return response()->json([
|
2022-11-22 15:15:52 +01:00
|
|
|
'message' => __('errors.unsupported_with_reverseproxy'),
|
|
|
|
], 400);
|
2020-10-12 14:00:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|