Issue
- I cannot embed widgets on another site (with a different domain) even though I have the checkbox "Allow users to add <portlet> to any website" enabled.
- "<Hostname> refused connection" error may be seen.
Environment
- Liferay DXP 7.3
Resolution
- Currently, the checkbox "Allow users to add <portlet> to any website" only impacts specifically Widget Pages.
- The purpose of this configuration is to allow a new portlet menu item "Add to any Website" in widget pages.
- This portlet menu item will then open a popup containing the iframe code similar to Portlet Preferences > Sharing tab.
- The issue blocking widget embedding is that Liferay will block embedding to different domains through X-FRAME-Options, in order to prevent clickjacking. You can verify this by viewing the browser console and checking for an X-FRAME-Options error.
- To enable the widget to be embedded, configure the X-FRAME-Options for the widget and the destination domain in the system-ext.properties file as below:
http.header.secure.x.frame.options.1=/widget/web/guest/<widget-uuid>/ |ALLOW-FROM https://<other-domain>
The <widget-uuid> can be obtained from the iframe code.
-
- Please note that the system-ext.properties file is set in the platform installation's class path (such as {LR_HOME}/{Tomcat}/WEB-INF/classes/ for Tomcat).