GhangZh opened a new issue #5662:
URL: https://github.com/apache/apisix/issues/5662


   ### Issue description
   
   I see the documentation inside the last can use serverless plugin to do 
external authentication, but this code how to configure into serverless plugin 
it can give an example?
   
![image](https://user-images.githubusercontent.com/92301646/144208600-b442fdcb-162b-472f-88ed-5402ae401192.png)
   I escaped through json compression and put it in the functions field is not 
possible, it seems that as the documentation says can only write functions, but 
how to put this code in it.
   ```bash
   "plugins": {
       "serverless-pre-function": {
         "disable": false,
         "functions": [
           
"localhttp=require('resty.http')localhttpc=http.new()localres,err=httpc:request_uri('http://www.baidu.com',{keepalive_timeout=2000,headers={[\"Content-Type\"]=\"application/json\",}})ifnotresorres.statusthencore.response.exit(403)returnifres.status==302thencore.response.exit(302)end"
         ]
       }
     },
   ```
   
![image](https://user-images.githubusercontent.com/92301646/144210856-64f528ed-ef55-4301-95ad-5cbe62585a61.png)
   
   
   ### Environment
   
   - apisix version (cmd: `apisix version`):2.10.2
   - OS (cmd: `uname -a`):
   - OpenResty / Nginx version (cmd: `nginx -V` or `openresty -V`):
   - etcd version, if have (cmd: run `curl 
http://127.0.0.1:9090/v1/server_info` to get the info from server-info API):
   - apisix-dashboard version, if have:
   - the plugin runner version, if the issue is about a plugin runner (cmd: 
depended on the kind of runner):
   - luarocks version, if the issue is about installation (cmd: `luarocks 
--version`):
   


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