Skip to content

bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian #8087

Description

@ada012

Current Behavior

Hi, I would also like to use nginx sub_filter in apisix, but it still doesn't work when I use it in apache/apisix:2.99.0-debian,and I see an identical issue and have been merged,there #5451

Expected Behavior

Before content:

<head>
    <title>test</title>
    <meta charset="utf-8">
</head>

ideally, use the content after filter:

<head>
    <title>test</title>
    <meta charset="utf-8">
    <script>console.log(1)</script>
</head>

However, it does not take effect

Error Logs

No response

Steps to Reproduce

  1. Use docker-compose deployment
  2. In the plugin/market path, enable the response-rewrite plugin
  3. configuration parameters are as follows
{
  "disable": false,
  "filters": [
    {
      "regex": "</head>",
      "replace": "<script>console.log(1)</script></head>",
      "scope": "global"
    }
  ],
  "headers": {
    "set": {
      "x-powered-by": "",
      "x-server-balancer_addr": "$balancer_ip:$balancer_port"
    }
  },
  "vars": [
    [
      "status",
      "==",
      200
    ],
    [
      "content-type",
      "==",
      "text/html; charset=utf-8"
    ]
  ]
}

Environment

  • APISIX version (run apisix version): apache/apisix:2.99.0-debian
  • APISIX Dashboard version, if relevant: apache/apisix-dashboard:2.13-alpine

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions