报错信息如下:
Refused to display ‘http://localhost:8080/msc/ordertype’ in a frame because it set ‘X-Frame-Options’ to ‘deny’.
原因:
Spring-Security 默认是设置了这个 “X-Frame-Options” 属性为DENY
解决:在http配置中设置
<http auto-config="true" use-expressions="true">
<headers>
<frame-options policy="SAMEORIGIN"/>
</headers>
</http>
X-Frame-Options:
他的值有三个:
(1)DENY — 表示该页面不允许在 frame 中展示,即便是在相同域名的页面中嵌套也不允许。
(2)SAMEORIGIN — 表示该页面可以在相同域名页面的 frame 中展示。
(3)ALLOW-FROM https://example.com/ — 表示该页面可以在指定来源的 frame 中展示。