AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[openresty](server)

Martin Hope
Minhaj
Asked: 2021-09-15 03:16:32 +0800 CST

从“ledge”中删除“Via”响应标头

  • 0

我有一个 Openresty 网络服务器,它也使用ledge作为缓存服务器。ledge 正在设置一个“Via”响应标头,该标头公开服务器的主机名,即 fqdn。

Via: 1.1 xyz.example.com

我的 openresty 和 ledge 配置中有这些:

more_clear_headers 'Server';
server_tokens off;

我想完全删除“Via”响应标头。但无法弄清楚如何在壁架上做到这一点:(

proxy nginx openresty http-headers
  • 1 个回答
  • 238 Views
Martin Hope
Leandro Moreira
Asked: 2020-09-10 04:03:27 +0800 CST

在body_filter_by_lua_block期间是否可以避免lua nginx上的分块传输?

  • 0

假设我们要更改来自上游的响应,我们可以做的是在body_filter_by_lua_block阶段使用 Lua+nginx,这是其中的一个片段。

  server {
    listen 8181;
    location /media {
        alias /media/;
    }
  }

  server {
    listen 8080;

    location /media {
        proxy_pass http://localhost:8181;

        # we need to keep this url since we're going to rewrite
        set_by_lua_block $original_uri { return ngx.var.uri }

        # when the Lua code may change the length of the response body
        header_filter_by_lua_block { ngx.header.content_length = nil }

        # removing (rewriting) the filters
        rewrite_by_lua_block {
          local uri = ngx.re.sub(ngx.var.uri, "^/media/(.*)/hls/(.*)$", "/media/hls/$2")
          ngx.req.set_uri(uri)
        }

        # applying the bandwidth min filter
        # but we can use the ngx.var.original_uri to build/select the filters
        body_filter_by_lua_block {
          local modified_manifest = filtering(ngx.arg[1])
          ngx.arg[1] = modified_manifest
          ngx.arg[2] = true
        }
    }

这工作得很好!但问题是,这种方式响应将使用分块传输,有些客户端无法处理分块响应,你知道我该如何克服吗?

nginx openresty lua
  • 1 个回答
  • 705 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve