Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access WordPress Dashboard in an iframe

I have an iframe on http://foo.example.com which targets to http://bar.example.com.

On http://bar.example.com is a WordPress installation. I'm able to view the page and click on all pages and post but when I try to go to the backend I get

Refused to display document because display forbidden by X-Frame-Options.

and the request is aborted.

According to this question I aded this header which gets send successfully:

header('X-Frame-Options: GOFORIT');

What else can limit the access to just the dashboard (and the login screen)?

I have access to both subdomains and can use a htaccess as well

like image 837
Xaver Avatar asked Dec 20 '22 11:12

Xaver


1 Answers

Here is a better solution that won't break when you update Wordpress:

remove_action( 'login_init', 'send_frame_options_header' );
remove_action( 'admin_init', 'send_frame_options_header' );

Here's another solution if you're using Apache. Throw this in your .htaccess:

<IfModule mod_headers.c>
    Header unset X-Frame-Options
    Header always unset X-Frame-Options
</IfModule>
like image 138
jaggedsoft Avatar answered Dec 27 '22 07:12

jaggedsoft