我有两个 WordPress 网站,一个为 sourceURL,另一个为目标 URL。targetURL 有一个 iframe 来呈现来自 sourceURL 的内容。当我尝试运行显示其他内容的 iframe 时,出现以下错误:
\n\ndestinationURL refused to display sourceURL in a frame because it set \'X-Frame-Options\' to \'sameorigin\'.\nRun Code Online (Sandbox Code Playgroud)\n\n我似乎找不到 wordpress 设置 x-frame 选项的位置。我检查了以下内容:
\n\n.htaccess - 我删除了 htaccess 文件中的所有安全选项。我还尝试通过 htaccess 启用 x-frame。这样做会给我一个错误,即我有两个相互冲突的规则。
\n\n<IfModule mod_headers.c>\n Header set X-Frame-Options "ALLOW-FROM destinationURL\xe2\x80\x9c\n</IfModule>
所有与 root wp 相关的文件。我似乎找不到任何更新设置的配置。
在这个阶段,我怀疑 wordpress 有默认配置。
\n\nwordpress如何将x-frame选项限制为sameorigin?
\n\n我希望你们中的一个人以前经历过这种情况,并在我在所有文件中 grep 查找 \'x-frame\' 或 sameorigin 之前,引导我了解 wordpress 如何禁用 …
我尝试使用Python 在Treasury Direct上请求RSS提要。过去,我曾使用urllib或请求库来达到此目的,并且效果很好。但是,这次,我继续收到406状态错误,据我了解,这是页面告诉我它不接受请求中标头详细信息的方式。我已经尝试将其更改为无济于事。
这就是我尝试过的方式
import requests
url = 'https://www.treasurydirect.gov/TA_WS/securities/announced/rss'
user_agent = {'User-agent': 'Mozilla/5.0'}
response = requests.get(url, headers = user_agent)
print response.text
Run Code Online (Sandbox Code Playgroud)
环境: Python 2.7和3.4。我也尝试通过curl进行访问,并具有完全相同的错误。
我认为这是特定于页面的,但是无法弄清楚如何适当地构造阅读此页面的请求。
我在页面上找到了一个API,可以在json中读取相同的数据,因此对我来说,这个问题比真正的问题更令人好奇。
任何答案将不胜感激!
标头详细信息
{'surrogate-control': 'content="ESI/1.0",no-store', 'content-language': 'en-US', 'x-content-type-options': 'nosniff', 'x-powered-by': 'Servlet/3.0', 'transfer-encoding': 'chunked', 'set-cookie': 'BIGipServerpl_www.treasurydirect.gov_443=3221581322.47873.0000; path=/; Httponly; Secure, TS01598982=016b0e6f4634928e3e7e689fa438848df043a46cb4aa96f235b0190439b1d07550484963354d8ef442c9a3eb647175602535b52f3823e209341b1cba0236e4845955f0cdcf; Path=/', 'strict-transport-security': 'max-age=31536000; includeSubDomains', 'keep-alive': 'timeout=10, max=100', 'connection': 'Keep-Alive', 'cache-control': 'no-store', 'date': 'Sun, 23 Apr 2017 04:13:00 GMT', 'x-frame-options': 'SAMEORIGIN', '$wsep': '', 'content-type': 'text/html;charset=ISO-8859-1'}
Run Code Online (Sandbox Code Playgroud) 我有一个格式如下的 csv 文件:
type,type_mapping, style,style_mapping,Count
Residential,Residential,Antique,Antique,109
Antique,Residential,Antique,Antique,48
Apt/Garage,Commercial,Apt/Garage,Apartment,1
Run Code Online (Sandbox Code Playgroud)
我正在使用 Python(版本 3)中的 csv 模块解析它。这是我的代码:
import os
import csv
typeXref = dict()
with open('xref.csv') as csvData:
csvRead = csv.reader(csvData)
headers = next(csvRead)
for index, row in enumerate(csvRead):
typeXref[index] = {key: value for key, value in zip(headers, row)}
print(typeXref)
Run Code Online (Sandbox Code Playgroud)
出于某种原因,我的第一列不断返回\ufeff标题中第一列的字节顺序标记。
408: {'\ufefftype': 'Residential', 'type_mapping': 'Residential',
' style': 'Antique', 'style_mapping': 'Antique', 'Count': '109'}}
Run Code Online (Sandbox Code Playgroud)
我认为这是由于我打开文件、使用csv模块读取内容或生成文件的方式造成的。
我可以弄清楚如何解码该字段,但宁愿确保我正确生成文件,或使用csv模块属性。
我收到了来自 mac 的通知,要求我从 Catalina 升级到 Big Sur。在过去5年没有任何修改的情况下升级后,我只是在一夜之间接受了升级。今天,我发现我创建的名为 /srv 的自定义文件夹中的所有源代码都找不到了。
有没有其他人注意到类似的问题,如果有,有没有办法在不使用时间机器或 iCloud 的情况下恢复这些文件夹?我希望 Mac 不会在没有警告我的情况下盲目删除我的根文件夹。这将是升级过程中的严重违规。
我一直在研究这个问题,由于 CORS 限制,特定字体文件未在远程站点上呈现。
到目前为止,我已经能够确定对该 url 的请求正在使用 access-control-allow-origin 进行响应,但 nginx 在远程发出时拒绝对该字体的请求。
我正在使用 laravel 和 spatie 的 laravel-cors 插件,但我认为这不会返回未从 laravel 路由渲染的样式表或字体的标头信息。
有谁知道为什么会发生这种情况?
我的错误
Access to font at 'https://example.com/css/widget-icons/icomoon.ttf?wiodlm' from origin 'http://www.second-example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Run Code Online (Sandbox Code Playgroud)
通过curl检索标头(似乎允许curl请求)
curl -I https://example.com/css/widget-icons/icomoon.ttf?wiodlm
HTTP/2 200
date: Sun, 13 Jan 2019 16:57:34 GMT
content-type: application/x-font-ttf
content-length: 1316
set-cookie: AWSALB=r3yRudj6XwTlfaFzEdtxrecHzLLplOKlpRMbKuqL8InwUQYylNVFaZtmGHK2wQDgjvaXsBtRVcTCyjWidjTFUFmoDzKLBLH0gL6qarns38Qn4FuDNCZogawHtOjD; Expires=Sun, 20 Jan 2019 16:57:34 GMT; Path=/
server: nginx/1.14.1
last-modified: Tue, 25 Dec 2018 05:42:49 GMT
etag: …Run Code Online (Sandbox Code Playgroud) python ×2
.htaccess ×1
cors ×1
csv ×1
curl ×1
filesystems ×1
http-headers ×1
laravel ×1
macos ×1
nginx ×1
nginx-config ×1
php ×1
python-3.x ×1
unicode ×1
urllib ×1
wordpress ×1