Support the ongoing development of Laravel.io →
posted 1 year ago
Laravel
Last updated 1 year ago.
0

I got the solution last , it's a Middleware blocking. As part of security auditing I block host based on IP's . But when put in domain it will block and got 403 Forbidden error. I changed the middleware function below

public function handle($request, Closure $next)
    {
        $allowedHosts = ['127.0.0.1:8000', '10.50.192.128'];

        if (!in_array($request->getHost(), $allowedHosts)) {
            abort(403);
        }

        return $next($request);
    }

as

public function handle($request, Closure $next)
    {
        $allowedHosts = ['careers-ksrtc.karnataka.gov.in'];

        if (!in_array($request->getHost(), $allowedHosts)) {
            abort(403);
        }

        return $next($request);
    }

The problem fixed. Thanks to all especially my collegue Aruna .

flipmedia liked this reply

1
Solution selected by @flipmedia

Sign in to participate in this thread!

Eventy

Your banner here too?

flipmedia flipmedia Joined 22 Nov 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.