HOW To set htaccess to enable embed in iframe from another website [closed]
I have these 2 servers, one with virtual tour folder in it eg:
1st server: somevirtualserver.com/vr/propertygood
then other server: virtualviewer.com/virtualpage/index.html
and I want to embed it in an iframe
tag html
but then I get message
Can’t Open This Page
inside the iframe, so i guess there might be a htaccess setup to enable
here is the code in virtualviewer.com/virtualpage/index.html:
<iframe id="inlineFrameExample"
title="Inline Frame Example"
width="300"
height="200"
src="somevirtualserver.com/vr/propertygood">
</iframe>
the result is
EDIT:
Not sure this is right:
Header always append X-Frame-Options ALLOW-FROM=*
Is there a way in htaccess to enable embedding from another website?
You are on the right track. You need to set the X-Frame-Option to allow to embed the page.
You can do this in a .htaccess file, but only if Apache is configured to allow it. If the Apache configuration does not allow Header directives in the .htaccess file and you don't have control over the Apache config you are out of luck. However, if you can edit the Apache config you should add it there instead of the .htaccess file.
You need to configure this on the server where the page that should be embedded resides, in your case somevirtualserver.com
.
Header always append X-Frame-Options ALLOW-FROM virtualviewer.com
I've completed this by setting apache config on my ubuntu under security.conf so it won't mess another directory and malicious embed
<Directory /var/www/rootweb/html/public/vr/virtualserving>
Header always unset X-Frame-Options
</Directory>