Search code examples
laravellaravel-4http-headerssame-origin-policy

Laravel 4 refuses to load iframe due to 'X-Frame-Options' to 'SAMEORIGIN'


I am building a chrome extension in which I am showing an iframe on a popup from the Gmail home page. As Gmail home page is in HTTPS , my iframe should also be in https. I configured apache2 by enabling mod_ssl and got HTTPS working on apache2. I made a native PHP page and tried to show that on the frame which is on Gmail page. I had no problems it was loading the page from localhost. But when I wanted to use a Laravel backend, it showed me error.

Refused to display 'https://localhost/laravel/laravel/public/index.php/chromelogin' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Any Suggestions??


Solution

  • Add following line in your bootstrap/start.php file:

    $app->forgetMiddleware('Illuminate\Http\FrameGuard');