この記事は、ドキュメントライブラリ にアップロードされた PNG ファイルが、 DOM7009 を持つ IE11 で 表示されないという既知の問題を説明しています:コンソールでURLの画像 をデコードできない。
セキュリティ対策として、またブラウザで悪意のあるスクリプトが実行されるのを防ぐために、LiferayはMIMEスニッフィングから保護するために X-Content-Type-Options: nosniff
HTTPヘッダーを送ります。
system.propertiesのデフォルト値です:
# Set this to true for the portal to send the "X-Content-Type-Options: # nosniff" HTTP header to protect against MIME sniffing. Custom URLs can # specified in the property # "http.header.secure.x.content.type.options.urls.excludes" that allow for # unhindered MIME sniffing. # http.header.secure.x.content.type.options=true
この動作は、Internet Explorer 8(、 Microsoftのドキュメント)以来、知られており、意図されています。
要約すると、サーバーがレスポンスヘッダ X-Content-Type-Options: nosniff
を送信すると、script と styleSheet 要素は不正な MIME タイプのレスポンスを拒否します。
解決策
この動作を解決するには、2つの選択肢があります。 この2つのオプションのいずれかを設定する場合は、潜在的なリスクを認識した上で、ご自身の判断で行ってください:
オプション1
Disable X-Content-Type-Options: nosniff
Liferay から送信されています。
- system-ext.properties で
http.header.secure.x.content.type.options=false
を設定します。 - ファイルを保存する
- サーバーを再起動する
オプション2
MIMEスニッフィングを許可する正確なURLを定義してください:
- system-ext.propertiesファイルに、system.propertiesのdefaultプロパティに見られるように、MIMEスニッフィングを妨げないようにするカンマ区切りのURLプレフィックスを設定します:
# Set a list of comma delimited URL prefixes that allow for unhindered # MIME sniffing. This property is only used when the property # "http.header.secure.x.content.type.options" is set to true. # http.header.secure.x.content.type.options.urls.excludes=
- ファイルを保存する
- サーバーを再起動する