You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/10/14 03:40:33 UTC

[GitHub] [apisix] chyoong opened a new issue, #8087: bug:

chyoong opened a new issue, #8087:
URL: https://github.com/apache/apisix/issues/8087

   ### 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 https://github.com/apache/apisix/issues/5451
   
   ### Expected Behavior
   
   Before content:
   ```html
   <head>
       <title>test</title>
       <meta charset="utf-8">
   </head>
   ```
   
   ideally, use the content after `filter`:
   ```html
   <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
   ```json
   {
     "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`): 2.99.0
   - Operating system (run `uname -a`): Linux test 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`): bitnami/etcd:3.4.15
   - APISIX Dashboard version, if relevant: apache/apisix-dashboard:2.13-alpine
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on issue #8087: bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian

Posted by GitBox <gi...@apache.org>.
soulbird commented on issue #8087:
URL: https://github.com/apache/apisix/issues/8087#issuecomment-1278496768

   same as #7852 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on issue #8087: bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian

Posted by GitBox <gi...@apache.org>.
soulbird commented on issue #8087:
URL: https://github.com/apache/apisix/issues/8087#issuecomment-1294298496

   > Please read document https://apisix.apache.org/docs/apisix/terminology/plugin/#plugin-common-configuration Currently apisix only support request parameters, so your configuration is not right. You should remove condition on vars
   > 
   > ```
   > "vars": [
   >     [
   >       "status",
   >       "==",
   >       200
   >     ],
   >     [
   >       "content-type",
   >       "==",
   >       "text/html; charset=utf-8"
   >     ]
   >   ]
   > ```
   > 
   > to
   > 
   > ```
   > "var": []
   > ```
   
   The response-rewrite plugin has already received the response when executing the `vars` expression, so it can contain some variables in the response, you can check this test case: https://github.com/apache/apisix/blob/master/ t/plugin/response-rewrite2.t#L236


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] mscb402 commented on issue #8087: bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian

Posted by GitBox <gi...@apache.org>.
mscb402 commented on issue #8087:
URL: https://github.com/apache/apisix/issues/8087#issuecomment-1281763199

   Please read document https://apisix.apache.org/docs/apisix/terminology/plugin/#plugin-common-configuration 
   Currently apisix only support request parameters, so your configuration is not right. You should remove condition on vars
   ```
   "vars": [
       [
         "status",
         "==",
         200
       ],
       [
         "content-type",
         "==",
         "text/html; charset=utf-8"
       ]
     ]
   ```
   to 
   ```
   "var": []
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on issue #8087: bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian

Posted by GitBox <gi...@apache.org>.
soulbird commented on issue #8087:
URL: https://github.com/apache/apisix/issues/8087#issuecomment-1294298334

   > t request parameters,
   
   The response-rewrite plugin has already received the response when executing the `vars` expression, so it can contain some variables in the response, you can check this test case: https://github.com/apache/apisix/blob/master/ t/plugin/response-rewrite2.t#L236


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] soulbird commented on issue #8087: bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian

Posted by GitBox <gi...@apache.org>.
soulbird commented on issue #8087:
URL: https://github.com/apache/apisix/issues/8087#issuecomment-1294288545

   ```
   <head>
       <title>test</title>
       <meta charset="utf-8">
   </head>
   ```
   Can you give a full upstream response? Contains response headers and a response body.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] chyoong closed issue #8087: bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian

Posted by GitBox <gi...@apache.org>.
chyoong closed issue #8087: bug: Invalid filter with response-rewrite in apache/apisix:2.99.0-debian
URL: https://github.com/apache/apisix/issues/8087


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org