Message Boards

X-Frame options for remoting a page

Gianluca Bonetti, modified 7 Years ago.

X-Frame options for remoting a page

New Member Posts: 3 Join Date: 8/7/12 Recent Posts
Hello everyone!

I am quite new to Liferay, but I have already done some work and well, it works.

What I cannot manage, is remoting a page to be embedded in an iframe on another site.
More specifically, the other site is done in Wordpress and should embed the Liferay page in an iframe.

The browser does not display the iframe content and this is what I read in the browser console:
Refused to display '......' in a frame because it set 'X-Frame-Options' to 'sameorigin'

Googling around, I found that I should put a property in ${liferay.home}/portal-ext.properties to allow that.
The property should be http.header.secure.x.frame.options.1=/path/to/page
Since this is a multi-site Liferay instance, I put http.header.secure.x.frame.options.1=/web/site1234

Liferay loads correctly the property, I can see it has been loaded by:
Control Panel -> Server Administration -> Properties -> Portal Properties -> set filter "x.frame"

Yet, it does not produce the desired effect, that is the page being displayied in an iframe on another site.

I am sure I am missing some point.
Any hint?

Thank you
Gianluca
thumbnail
Samuel Kong, modified 7 Years ago.

RE: X-Frame options for remoting a page

Liferay Legend Posts: 1902 Join Date: 3/10/08 Recent Posts
You have the wrong file. You should be looking at system.properties instead of portal.properties.
Gianluca Bonetti, modified 7 Years ago.

RE: X-Frame options for remoting a page

New Member Posts: 3 Join Date: 8/7/12 Recent Posts
Samuel Kong:
You have the wrong file. You should be looking at system.properties instead of portal.properties.


Thank you Samuel, you rock!

I found in other threads on the community forum that it was to be set in portal-ext.properties, but it does not work.
I did like you pointed out and it worked like a charm.

More specifically, I added to ${liferay.home}/tomcat-8.0.32/webapps/ROOT/WEB-INF/classes/system-ext.properties the following lines

http.header.secure.x.frame.options.1=/web/path/to/first/site
http.header.secure.x.frame.options.2=/web/path/to/second/site


Thank you very much!
Bye
Gianluca Bonetti