1

I have a view that is trying to load a webpage from Zendesk after getting its JSON Web Token but it's not loading. OK, trying a known-good iframe from a working site outside of Laravel I attempt to find out if it's a goof on my end, or something in Laravel.

I'm using the steps in Laravel 4 refuses to load iframe due to 'X-Frame-Options' to 'SAMEORIGIN'

but all return a blank space inside the iframe element. I've searched for that using Google but I've not found results that replicate what I'm seeing.

<iframe title="Tickets" style="width: 80%; height: 500px;" src="http://www.example.com">
  <html><head></head><body></body>
  </html>
            </iframe>

So I've done this according to the quoted SO post:

php artisan make:provider AddIframeServiceProvider

Added

`$this->app->removeMiddleware('Illuminate\Http\FrameGuard');`

to app/Providers/AddIframServiceProvider.php

Added variations of

`$this->app->removeMiddleware('Illuminate\Http\FrameGuard')`

in app/Providers/AppServiceProvider.php

But kept getting variations of this error:

`Call to undefined method Illuminate\Foundation\Application::removeMiddleware()`

Commented those two lines out of the ServiceProvider files above and tried the other suggestion which was to comment the line:

`$response->headers->set('X-Frame-Options', 'SAMEORIGIN', false);`

in the \Illuminate\Http\Middleware\FrameGuard.php

Tried different variations of this header, SAMEORIGIN set to true, ALLOW-FROM http://example.com but still no working result.

From what I'm reading about X-Frame-Options it seems I'm setting my Laravel page header to prevent others from incorporating my site in an iframe. My working example.com does not have this header set, nor does the Zendesk page I'm trying to load.

So I'm probably hitting the wrong spots in Laravel 5.1 to be able to load up an external page, or going down the wrong alley with trying to modify the middleWare class.

What am I overlooking? thx, sam

Community
  • 1
  • 1
sam452
  • 1,281
  • 3
  • 20
  • 33

0 Answers0