You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Webflow平台托管/.well-known/security.txt文件?

在Webflow上托管security.txt的替代方法

当你尝试给/.well-known/security.txt设置301重定向时遇到Invalid .well-known request错误,是因为Webflow对.well-known路径有特殊限制,无法直接通过重定向规则配置。以下是两种可行的托管方案:

方案1:自定义页面路径直接输出内容

这是最直接的方法,通过创建Webflow页面并指定对应路径来模拟/.well-known/security.txt:

  • 在Webflow后台创建一个新的空白页面
  • 进入页面的「设置」→「SEO」,将「页面路径」修改为/.well-known/security.txt
  • 切换到「自定义代码」标签,在「页面头部代码」中添加以下代码,用来设置正确的内容类型并输出security.txt内容:
<meta http-equiv="Content-Type" content="text/plain; charset=utf-8">
<script>
  document.body.innerHTML = `
Contact: mailto:security@yourdomain.com
Encryption: https://yourdomain.com/public-key.asc
Acknowledgments: https://yourdomain.com/security-hall-of-fame
Policy: https://yourdomain.com/security-policy.html
Expires: 2025-12-31T23:59:59Z
  `;
</script>
  • 发布站点后,访问https://yourdomain.com/.well-known/security.txt即可看到正确的纯文本内容

方案2:上传文件并通过自定义路由映射

如果希望直接托管文件而非通过页面渲染:

  • 将你的security.txt文件上传到Webflow的「资产库」中,复制文件的直接访问链接
  • 创建一个空白页面,设置页面路径为/.well-known/security.txt
  • 在页面的「自定义代码」→「页面头部代码」中添加meta刷新标签:
<meta http-equiv="Refresh" content="0; url=https://assets.website-files.com/your-file-path/security.txt">
<meta http-equiv="Content-Type" content="text/plain; charset=utf-8">
  • 发布后访问目标路径会自动跳转到你上传的文件

注意事项

  • 务必设置Content-Type为text/plain,避免浏览器将内容解析为HTML
  • 测试时使用HTTP状态码检查工具,确保返回200(方案1)或正确的跳转状态码(方案2)
  • 不要尝试通过Webflow的重定向规则直接配置.well-known路径,平台的限制会导致Invalid .well-known request错误

内容的提问来源于stack exchange,提问作者lmaooooo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 08:07:20