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 2020/11/16 15:25:49 UTC

[GitHub] [apisix-dashboard] Applenice opened a new issue #814: proxy-rewrite header invalid configuration

Applenice opened a new issue #814:
URL: https://github.com/apache/apisix-dashboard/issues/814


   Please answer these questions before submitting your issue.
   
   - Why do you submit this issue?
   - [ ] Question or discussion
   - [X] Bug
   - [ ] Requirements
   - [ ] Feature or performance improvement
   - [ ] Other
   
   ___
   ### Question
   - What do you want to know?
   `proxy-rewrite` plugin header configuration is not working,capturing packets by tcpdump reveals that the http request does not carry header information.
   
   ___
   ### Bug
   - Which version of Apache APISIX Dashboard, OS, and Browser?
   ```
   $ pwd
   /usr/local/src/apisix
   $ git branch -v
   * master c1ac7d6 docs: add a English link of node-status.md (#2753)
   
   $ pwd
   /usr/local/src/apisix-dashboard
   $ git branch -v
   * v2.0 59515b5 feat: skip puppeteer chromium download when build (#808)
   ```
   - What happened?
   
   Client   192.168.199.213   Curl 7.55.1
   apisix and apisix-dashboard  192.168.199.118 
   
   ##### Use API Method
   ```
   $ curl http://127.0.0.1:9080/apisix/admin/routes/1  -H 'X-API-KEY: edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
   > {
   >     "methods": ["GET"],
   >     "uri": "/geo/*",
   >     "plugins": {
   >         "proxy-rewrite": {
   >             "regex_uri": ["^/geo/(.*)$","/json/$1"],
   >             "scheme": "http",
   >             "host": "ip-api.com",
   >             "headers": {
   >                 "X-Api-Version": "v1",
   >                 "X-Api-Engine": "apisix",
   >                 "Accept": "application/json"
   >             }
   >         }
   >     },
   >     "upstream": {
   >         "type": "roundrobin",
   >         "nodes": {
   >             "ip-api.com:80": 1
   >         }
   >     }
   > }'
   {"header":{"revision":"43","cluster_id":"14841639068965178418","raft_term":"6","member_id":"10276657743932975437"},"action":"set","node":{"key":"\/apisix\/routes\/1","value":{"priority":0,"uri":"\/geo\/*","upstream":{"hash_on":"vars","nodes":{"ip-api.com:80":1},"type":"roundrobin","pass_host":"pass"},"id":"1","update_time":1605537606,"plugins":{"proxy-rewrite":{"scheme":"http","host":"ip-api.com","headers":{"X-Api-Version":"v1","Accept":"application\/json","X-Api-Engine":"apisix"},"regex_uri":["^\/geo\/(.*)$","\/json\/$1"]}},"create_time":1605537606,"methods":["GET"]}}}
   ```
   Request with curl on the client and run tcpdump on the machine where APISIX is located. Follow TCP Stream result: 
   ```
   GET /json/8.8.8.8 HTTP/1.1
   Host: ip-api.com
   X-Real-IP: 192.168.199.213
   X-Forwarded-For: 192.168.199.213
   X-Forwarded-Proto: http
   X-Forwarded-Host: 192.168.199.118
   X-Forwarded-Port: 9080
   User-Agent: curl/7.55.1
   Accept: application/json
   X-Api-Version: v1
   X-Api-Engine: apisix
   
   HTTP/1.1 200 OK
   ```
   Custom Header information is carried in the API method.
   
   ##### Use Dashboard
   After I configured it, I observed the network request and here is the configuration returned: 
   ```
   {
       "id": "328844533926199973",
       "create_time": 1605536216,
       "update_time": 1605539246,
       "uris": [
           "/ip/*"
       ],
       "name": "T-3",
       "methods": [
           "GET"
       ],
       "hosts": [
           "192.168.199.118"
       ],
       "vars": [],
       "plugins": {
           "proxy-rewrite": {
               "headers": {
                   "Accept": {
                       "key": "Accept",
                       "value": "application/json"
                   },
                   "X-Api-Engine": {
                       "value": "apisix"
                   },
                   "X-Api-Version": {
                       "value": "v1"
                   }
               },
               "host": "ip-api.com",
               "regex_uri": [
                   "^/ip/(.*)$",
                   "/json/$1"
               ],
               "scheme": "http"
           }
       },
       "upstream": {
           "nodes": [
               {
                   "host": "ip-api.com",
                   "port": 80,
                   "weight": 1
               }
           ],
           "timeout": {
               "connect": 6000,
               "read": 6000,
               "send": 6000
           },
           "type": "roundrobin"
       }
   },
   ```
   Also run tcpdump on the machine where APISIX is located.Follow TCP Stream result:
   ```
   GET /json/8.8.8.8 HTTP/1.1
   Host: ip-api.com
   X-Real-IP: 192.168.199.213
   X-Forwarded-For: 192.168.199.213
   X-Forwarded-Proto: http
   X-Forwarded-Host: 192.168.199.118
   X-Forwarded-Port: 9080
   User-Agent: curl/7.55.1
   
   HTTP/1.1 200 OK
   ```
   After comparison, it can be seen that Header information is not carried at all when configured via Dashboard.
   
   Another question: why is the `Accept` field in header formatted differently than the `X-Api-Engine` and `X-Api-Version` fields?
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] liuxiran commented on issue #814: proxy-rewrite header invalid configuration

Posted by GitBox <gi...@apache.org>.
liuxiran commented on issue #814:
URL: https://github.com/apache/apisix-dashboard/issues/814#issuecomment-728606950


   Thanks for your feedback,  the same reason as https://github.com/apache/apisix-dashboard/issues/793, there are some transform errors in fe plugin component,  and after the errors fixed, `@api7-dashboard/plugin` will be upgraded to `1.0.14`+ .
   


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] Applenice commented on issue #814: proxy-rewrite header invalid configuration

Posted by GitBox <gi...@apache.org>.
Applenice commented on issue #814:
URL: https://github.com/apache/apisix-dashboard/issues/814#issuecomment-728635697


   > Thanks for your feedback, the same reason as #793, there are some transform errors in fe plugin component, and after the errors fixed, `@api7-dashboard/plugin` will be upgraded to `1.0.14`+ .
   
   So that's it, hope to upgrade soon, thanks!😃


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on issue #814: proxy-rewrite header invalid configuration

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #814:
URL: https://github.com/apache/apisix-dashboard/issues/814#issuecomment-728643029


   We are working on a feature for the plugin module, that you could pass JSON directly to API instead of using Form.


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan edited a comment on issue #814: proxy-rewrite header invalid configuration

Posted by GitBox <gi...@apache.org>.
juzhiyuan edited a comment on issue #814:
URL: https://github.com/apache/apisix-dashboard/issues/814#issuecomment-728643965


   We will keep both Form and code-mirror.
   
   All plugins will support this, and it will resolve all most UI issues finally!


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan commented on issue #814: proxy-rewrite header invalid configuration

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on issue #814:
URL: https://github.com/apache/apisix-dashboard/issues/814#issuecomment-728643965


   We will keep both Form and code-mirror.
   
   All plugins will support this, and it will all most UI issues finally!


----------------------------------------------------------------
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.

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



[GitHub] [apisix-dashboard] juzhiyuan closed issue #814: proxy-rewrite header invalid configuration

Posted by GitBox <gi...@apache.org>.
juzhiyuan closed issue #814:
URL: https://github.com/apache/apisix-dashboard/issues/814


   


----------------------------------------------------------------
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.

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