Liferayポートレットを外部サイトと共有しようとすると、接続/認証エラーが発生する場合があります。
再現する手順:
- ブログポートレット(または任意のポートレット)をページに追加します
- ブログをブログポートレットに追加します
- 設定>共有 を選択し、スクリプトをコピーして外部サイトとの共有を選択します
- 別のIPで新しいLiferayインスタンスを開きます
- Webコンテンツ表示ポートレットをページに追加します
- 記事を追加します
- ソースを選択し、スクリプトを追加します
- Internet Explorer(IE)10で、Webコンテンツの記事を含むページを表示します
期待される結果:
外部サイトにポートレットが表示されます。
実結果:
ポートレットは表示されません。IEでは、ユーザーはWebコンテンツ表示内に 「このコンテンツはフレームに表示できません」 というメッセージを受け取ります(LiferayではなくIEメッセージのように見えます)。
Firefoxでは、Webコンテンツ表示は空白です。
解決策
この問題は、 portal-ext.properties ファイルに以下のプロパティを設定することで解決されます。
# If the property "http.header.secure.x.frame.options" is set to true, then # the portal will iterate through the properties # "http.header.secure.x.frame.options.*" where the wildcard "*" # is replaced with an int number starting from 0 and ending with 255 to find # a pipe (|) delimited URL and HTTP header value pair (e.g. "/|SAMEORIGIN"). # # Upon finding a matched a URL, the portal will use the custom HTTP header # value instead of the "DENY" value. # # By default, URLs that start with "/" will use a custom HTTP header value # of "SAMEORIGIN". Specify another URL and HTTP header value with a number # smaller than 255 to intercept this default behavior. # http.header.secure.x.frame.options.255=/|SAMEORIGIN
たとえば、ブログウィジェットを共有する場合、以下の方法でプロパティを設定します。
http.header.secure.x.frame.options.1=/widget/web/guest/home/-/blogs