chilcano commented on issue #9928:
URL: https://github.com/apache/apisix/issues/9928#issuecomment-1659908965

   Thanks @qwzhou89 
   
   Quick questions:
   1. What is `$status` in the first route?
   2. In the 2nd route. Why not using the `/api1` response (HTTP_STATUS or json 
body) instead of using custom header `X-Api1-Status`?. 
   
   I've tried this approach, but I don't know how get the `/api1` response 
(headers, json body) in the 1st `proxy-rewrite` plugin from 2nd plugin 
`serverless-post-function`. 
   
   This is my only 1 route.
   
   ```json
   {
      "uri": "/api1/*",
      "methods":["GET"],
      "plugins": {
         "proxy-rewrite": {
            "host": "random-data-api.com",
            "uri": "/api/v2/banks",
            "scheme": "https"
         },
         "serverless-post-function": {
            "phase": "body_filter",
            "functions": [
               "return function(conf, ctx)
                     -- Print the iban value of json_response
               end"
            ]
         }
      },
      "upstream_id": 1
   }'
   ```
   The Random Banks API (https://random-data-api.com/api/v2/banks) returns this:
   ```json
   {
     "id": 5243,
     "uid": "f38123fc-7c1d-4705-980f-3e82e770b100",
     "account_number": "0638101451",
     "iban": "GB86RWJD49924585669735",
     "bank_name": "UBS CLEARING AND EXECUTION SERVICES LIMITED",
     "routing_number": "290583418",
     "swift_bic": "BOFAGB3SSWI"
   }
   ```
    
   
   And the upstream is:
   ```json
   {
      "name": "Random API upstream",
      "type": "roundrobin",
      "scheme": "https",
      "nodes": {
         "random-data-api.com": 1
      }
   }
   ```
   
   Should I use `serverless-pre-function` and different `phase` ?
   Or should I use a custom plugin?
   Appreciate your support.
   
   Regards.
   


-- 
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-unsubscr...@apisix.apache.org

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

Reply via email to