【发布时间】:2018-03-01 02:03:36
【问题描述】:
我需要在 iframe 中显示一些网站,但我不能直接这样做,因为其中一些网站的标题 X-Frame-Options 设置为“SAMEORIGIN”。作为绕过这个的一种方法,我尝试在 apache 中使用反向代理。下面是我的apache配置
<VirtualHost *:80>
ServerName google.local
ProxyRequests Off
DocumentRoot /var/www/html/iframe-test
ProxyPass /test http://www.oracle.com/index.html
ProxyPassReverse /test http://www.oracle.com/index.html
ErrorLog /var/log/apache2/google.local-error.log
CustomLog /var/log/apache2/google.local-access.log combined
<Location *>
AllowOverride All
Order allow,deny
Allow from all
# Header always append X-Frame-Options "ALLOW-FROM all"
Header add test-header 'test'
</Location>
但我仍然无法在 iframe 中加载网站,并且收到错误 Load denied by X-Frame-Options: https://www.oracle.com/index.html does not permit cross-origin framing.
【问题讨论】:
标签: apache iframe reverse-proxy x-frame-options