Skip to content

  • 项目
  • 群组
  • 代码片段
  • 帮助
  • 当前项目
    • 正在载入...
  • 登录 / 注册
G
go-ipfs
  • 概览
    • 概览
    • 详情
    • 活动
    • 周期分析
  • 版本库
    • 仓库
    • 文件
    • 提交
    • 分支
    • 标签
    • 贡献者
    • 分支图
    • 比较
    • 统计图
  • 问题 0
    • 议题 0
    • 列表
    • 看板
    • 标记
    • 里程碑
  • 合并请求 0
    • 合并请求 0
  • CI / CD
    • CI / CD
    • 流水线
    • 作业
    • 日程表
    • 图表
  • 维基
    • Wiki
  • 代码片段
    • 代码片段
  • 成员
    • 成员
  • 折叠边栏
  • 活动
  • 图像
  • 聊天
  • 创建新问题
  • 作业
  • 提交
  • 问题看板
  • jihao
  • go-ipfs
  • Repository

切换分支/标签
  • go-ipfs
  • repo
  • config
  • gateway.go
查找文件
BlameHistoryPermalink
  • Lars Gierth's avatar
    gateway: enforce allowlist for path prefixes · 09937f84
    The gateway accepts an X-Ipfs-Path-Prefix header,
    and assumes that it is mounted in a reverse proxy
    like nginx, at this path. Links in directory listings,
    as well as trailing-slash redirects need to be rewritten
    with that prefix in mind.
    
    We don't want a potential attacker to be able to
    pass in arbitrary path prefixes, which would end up
    in redirects and directory listings, which is why
    every prefix has to be explicitly allowed in the config.
    
    Previously, we'd accept *any* X-Ipfs-Path-Prefix header.
    
    Example:
    
    We mount blog.ipfs.io (a dnslink page) at ipfs.io/blog.
    
    nginx_ipfs.conf:
    
        location /blog/ {
            rewrite "^/blog(/.*)$" $1 break;
            proxy_set_header Host blog.ipfs.io;
            proxy_set_header X-Ipfs-Gateway-Prefix /blog;
            proxy_pass http://127.0.0.1:8080;
        }
    
    .ipfs/config:
    
        "Gateway": {
            "PathPrefixes": ["/blog"],
            // ...
        },
    
    dnslink:
    
        > dig TXT _dnslink.blog.ipfs.io
        dnslink=/ipfs/QmWcBjXPAEdhXDATV4ghUpkAonNBbiyFx1VmmHcQe9HEGd
    
    License: MIT
    Signed-off-by: 's avatarLars Gierth <larsg@systemli.org>
    由 Lars Gierth 提交于 3月 28, 2016
    09937f84
gateway.go 237 Bytes
编辑Web IDE
×

Replace gateway.go

拖放文件到此处或者 点击上传


取消
将在派生(fork)项目中中创建一个新的分支, 并开启一个新的合并请求。