加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 运营中心 > Nginx > 正文

Nginx sub_filter重写了吗?

发布时间:2020-12-13 21:33:23 所属栏目:Nginx 来源:网络整理
导读:我正在尝试使用以下内容重写代理页面的正文链接: sub_filter http://proxied.page.come http://local.page.com; sub_filter_once off; 这是最好的方式吗? sub_filter module和substitutions_filter有什么区别 也可以在sub_filter delcaration中使用变量吗

我正在尝试使用以下内容重写代理页面的正文链接:

    sub_filter http://proxied.page.come http://local.page.com;
    sub_filter_once off;

这是最好的方式吗?
sub_filter module和substitutions_filter有什么区别

也可以在sub_filter delcaration中使用变量吗?

最佳答案
理想情况下,您应该要求后端写出正确的链接.虽然可以使用子过滤器来修复一些简单的情况,但通常不可能(例如,如果返回的数据不是文本而是例如闪存代码).

您可以在sub_filter中的替换字符串中使用变量(但不能在字符串中使用以匹配原始响应),它显式为documented:

A replacement string can contain variables.

至于子过滤器 – 它是第三方模块,预计会更强大,但可能包含更多错误.只要标准子过滤器足够您 – 您可能不想使用第三方子过滤器.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读