kong插件怎么使用

本篇内容主要讲解“kong插件怎么使用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“kong插件怎么使用”吧!

目录地址 /usr/local/share/lua/5.1/kong/plugins/proxy-cache

缓存

curl -i -X POST http://localhost:8001/plugins /--data name=proxy-cache /--data config.content_type="application/json" /--data config.cache_ttl=30 /--data config.strategy=memoryHTTP/1.1 201 CreatedDate: Fri, 31 Jul 2020 08:35:55 GMTContent-Type: application/json; charset=utf-8Connection: keep-aliveAccess-Control-Allow-Origin: *Server: kong/2.1.0Content-Length: 481X-Kong-Admin-Latency: 7{"created_at":1596184555,"id":"12ac84de-7006-46f7-99b9-94a0dec1b706","tags":null,"enabled":true,"protocols":["grpc","grpcs","http","https"],"name":"proxy-cache","consumer":null,"service":null,"route":null,"config":{"request_method":["GET","HEAD"],"cache_control":false,"vary_query_params":null,"storage_ttl":null,"response_code":[200,301,404],"cache_ttl":30,"vary_headers":null,"strategy":"memory","content_type":["application//json"],"memory":{"dictionary_name":"kong_db_cache"}}

查看缓存

curl -i -X GET http://localhost:8000/mock/requestHTTP/1.1 200 OKContent-Type: application/json; charset=utf-8Content-Length: 891Connection: keep-aliveX-Cache-Key: ea984309dd577124e1f65cde1065f6acX-Cache-Status: BypassServer: CowboyAccess-Control-Allow-Origin: *Access-Control-Allow-Methods: GETAccess-Control-Allow-Headers: host,connection,x-forwarded-for,x-forwarded-proto,x-forwarded-host,x-forwarded-port,x-real-ip,x-forwarded-prefix,user-agent,accept,x-request-id,via,connect-time,x-request-start,total-route-timeAccess-Control-Allow-Credentials: trueX-Powered-By: mockbinVary: Accept, Accept-EncodingEtag: W/"37b-sAIQN2uDDnfjTSxhJVhSJAtiNTU"Date: Fri, 31 Jul 2020 08:37:07 GMTVia: kong/2.1.0X-Kong-Upstream-Status: 200X-Kong-Upstream-Latency: 1256X-Kong-Proxy-Latency: 525Kong-Cloud-Request-ID: 96f8bc4accd38f58265fecccba92eac6X-RateLimit-Remaining-Minute: 4X-RateLimit-Limit-Minute: 5RateLimit-Remaining: 4RateLimit-Limit: 5RateLimit-Reset: 55

删除缓存

 curl -i -X DELETE http://localhost:8001/proxy-cacheHTTP/1.1 204 No ContentDate: Fri, 31 Jul 2020 08:38:58 GMTConnection: keep-aliveAccess-Control-Allow-Origin: *Server: kong/2.1.0X-Kong-Admin-Latency: 4

到此,相信大家对“kong插件怎么使用”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/222875.html

(0)
上一篇 2022年1月6日
下一篇 2022年1月6日

相关推荐

发表回复

登录后才能评论